-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usinn gotenberg-js-client in firebase function #36
Comments
Hello! |
Thank you for your quick answer. So, can I use it directly on my client side? Or do I need to do extra configuration besides installing package? |
I'm not good at Firebase, but I cannot find anything about is it possible to run Docker image within Firebase infrastructure or not... |
I have decided to use it in a firebase function after I see this advice: https://stackoverflow.com/a/66278206 but I couldn’t. If I am able to do that it would be perfect. I hope you help me. |
Hm. Actually, I'm not sure why this answer on SO marked as solution, because it doesn't contain any useful information, nor answer to the question... |
I have some experience in GCP products and I think (have not tested myself) that Gotenberg would be able to run in Cloud Run without any problems and you should easily be able to run the script you want as a Cloud Function when you have a proper Gotenberg instance running. Good luck! |
Gotenberg actually works on Cloud Run 😄 |
Do you have any example @gulien? Because I have tried many times but it didn't work unfortunately. |
Did you use the |
you mean that there is a cloud run version of it, right? If yes, I didnt use it. I will try. |
Exactly! See linked documentation in my first comment 👍 |
Thank you @gulien |
@gulien Oh, thanks for pointing out to documentation! |
I am trying to use gotenberg-js-client module in a firebase function as below:
**exports.officeToPdf = functions.https.onCall((req, res) => {
const https = require('https');
const {
pipe,
gotenberg,
convert,
url,
please,
} = require('gotenberg-js-client');
const signedUrlOptions = {
// stale options persist even after expiration date
action: 'read',
expires: Date.now() + 1000 * 60 * 2, // invalid date after ten minutes pass
};
const toPDF = pipe(
gotenberg('http://localhost:3000'),
convert,
url,
please,
);
admin
.storage()
.bucket()
.file(req)
.getSignedUrl(signedUrlOptions)
// eslint-disable-next-line promise/always-return
.then(url => {
console.log(url[0]);
// eslint-disable-next-line promise/no-nesting
toPDF(new URL(url[0]))
// eslint-disable-next-line promise/always-return
.then(pdf => {
console.log('ok');
console.log(pdf);
})
.catch(error => {
console.log(error);
});
})
.catch(err => {
console.log(err);
});
});**
but it gives error and it says:
Error: connect ECONNREFUSED 127.0.0.1:3000
I think I need to do something with http://localhost:3000 but I don't know what to do.
Could you help me?
The text was updated successfully, but these errors were encountered: