Closed AllanPinheiroDeLima closed 3 years ago
Hello! Gotenberg listens port 3000 by default, and using HTTP protocol, you should define this:
const convertToPdf = pipe(
gotenberg('http://gotenberg:3000')
// --8<--
I guess it should work like this, if Docker will resolve name gotenberg
inside virtual network.
Yes, it should, but weirdly enough, it didn't work. I took the right steps though.... i have put them in the same network, configured the dependencies correctly. But for some reason, redis does work, but gotenberg does not.
I will try something different now
Did you change code as I suggested? Because in your code you use just gotenberg("gotenberg")
, this is wrong.
Also, can you try docker exec bash into container with node application, and use curl
here, to connect Gotenberg container from within?
BTW as far as I know, docker-compose puts all containers from the single docker-compose.yml
file into the same virtual network by default, there is no need to do it explicitly.
Also, maybe Gotenberg needs some time for initialization. Compose's depends_on
doesn't wait for service to initialize, it just waits for container to start. If you launch node application right away and trying to connect to Gotenberg immediately — it might be not ready yet.
BTW as far as I know, docker-compose puts all containers from the single
docker-compose.yml
file into the same virtual network by default, there is no need to do it explicitly.
Yes, the network part is just because of the defaults that company uses on devops.
Did you change code as I suggested? Because in your code you use just
gotenberg("gotenberg")
, this is wrong. Also, can you try docker exec bash into container with node application, and usecurl
here, to connect Gotenberg container from within?
I did, but it didn't work either. To be honest, I have tried almost everything
Also, maybe Gotenberg needs some time for initialization. Compose's
depends_on
doesn't wait for service to initialize, it just waits for container to start. If you launch node application right away and trying to connect to Gotenberg immediately — it might be not ready yet.
I did a health check, but with no success. I will try to setup manually and check back to you
@AllanPinheiroDeLima I faced a similar issue: when addressing Gotenberg that ran in Docker directly (e.g. via Postman), everything worked as expected. But with the js client library, I always got a 404 error and Gotenborg was not even reached.
After a long and painful search, I figured that on my local machine were I ran the Gotenberg container, some other app was also running on port 3000! No idea why this did not resulted in some "Address in use" - nor why it worked with Postman - but as soon as changed the port, everything worked smoothly...
@AllanPinheiroDeLima any updates?
Yesterday I've published version 0.7.0, it has one fix in config merging logic, and introduces new low-level function adjust
, with it you can change any internal Request fields.
So, you have two ways for fine tuning:
gotenberg
accepts second argument, where you can specify any http.request
options — they will be used internally by default http client.adjust
you can change any internal Request object fields, for example, url
.And you have third, even more powerful way to change HTTP client behaviour: You can change default naive http client with completely your own one, for example, on top of got library. This feature is undocumented, but I can explain in more details, if you need it (in this comment I've written a simple description).
@AllanPinheiroDeLima I'll close this issue, as far as I reckon it is related to configuration. But feel free to reopen it in case I'm wrong, or any other updates!
I've mounted a dockerfile with all services needed on my server. But the link with gotenberg does not work. Is this the intended behavior ? Below, I'll share my actual code:
docker-compose.yml
And the script I used
Am I doing something wrong ?