You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm experiencing an issue when running Gotenberg (8-cloudrun) on Google Cloud Run behind Cloudflare. Intermittently, I receive a 502: create request context: get multipart form: client disconnected when making POST requests to /forms/pdfengines/merge and /forms/chromium/convert/html.
This started happening around January 13th. Retrying the call multiple time can resolve the issue, but the root cause is unclear.
It seems like the issue could be related to timeout or protocol mismatches between Cloudflare, Cloud Run, and Gotenberg. Any guidance or suggestions on how to resolve this would be appreciated!
I try different versions of gotenberg.
If you have any insights into why these issues are occurring that might help me solve them.
Reacted by Antoine GAGNEPAIN, Stijn Tratsaert and Fabian Frank
I'm not familiar with your configuration, so I cannot help much. I guess it's working fine when calling the Gotenberg instance via Cloud Run directly?
Hi, thank you for your response. I removed Cloudflare, and my application now calls Gotenberg directly on Cloud Run. However, I still encounter the same error on the path /forms/chromium/convert/html:
502 create request context: get multipart form: client disconnected
Activity
[-]502 error on /forms/pdfengines/merge[/-][+]Cloud Run: 502 error on /forms/pdfengines/merge[/+]gulien commentedon Jan 27, 2025
Hello @TessilimiTheo,
I'm not familiar with your configuration, so I cannot help much. I guess it's working fine when calling the Gotenberg instance via Cloud Run directly?
TessilimiTheo commentedon Jan 27, 2025
Hi, thank you for your response. I removed Cloudflare, and my application now calls Gotenberg directly on Cloud Run. However, I still encounter the same error on the path
/forms/chromium/convert/html:502 create request context: get multipart form: client disconnected
gulien commentedon Jan 27, 2025
Does it work when you use HTTP/2?
TessilimiTheo commentedon Jan 27, 2025
No, I'm already on HTTP/2
gulien commentedon Jan 27, 2025
I'm kinda out of ideas now 🤔 maybe @fank has some experience on this issue?
fank commentedon Jan 28, 2025
Not sure if helpful but I am using https://github.com/starwalkn/gotenberg-go-client to connect to gotenberg.
The command of how I deployed it:
--no-allow-unauthenticatedis just for authentication, does not make a different of how stable it is.So far the instance is running without any kind of connection issues.
The URL I am using to connect to the instance is the
.run.appdomain.novelnet commentedon Feb 2, 2025
Disabling HTTP/2 solved it for me mostly, also disabled NGINX in proxy redirect and changed the startup probe with delay (all together works for me):
sagikazarmark commentedon Feb 4, 2025
I have the same problem, except I don't use CloudFlare. It also started recently.
I just enabled debug logging. Info logs only reported 200 on the Gotenberg side and 502 on the Cloud Run side.
I will try disabling HTTP/2 and report back. If that's indeed the problem, I wonder if the recent Cloud Run v2 migration is related.
[-]Cloud Run: 502 error on /forms/pdfengines/merge[/-][+]Cloud Run: 502 error[/+]5 remaining items
stijntratsaertit commentedon Feb 6, 2025
According to these docs it is not advised - even prohibited - to use such connection headers when using HTTP/2.
stranavad commentedon Feb 6, 2025
I have also run into this issue today, gotenberg on cloud run, http/2 (we need more than 32MB), 502 Bad Gateway error
gulien commentedon Feb 6, 2025
What kind of HTTP/2 are you all using? H2C? Classic?
stijntratsaertit commentedon Feb 6, 2025
H2C.
This is the Cloud Run spec we're running.
gulien commentedon Feb 6, 2025
@fank are you using HTTP2 too?
sagikazarmark commentedon Feb 7, 2025
Debug logs didn't reveal anything. Looks like on Gotenberg's side everything works, the Cloud Run proxy still replies with 502 for some reason.
Disabling HTTP/2 solves the problem (or is at least a workaround for now).
TessilimiTheo commentedon Feb 10, 2025
Cloudrun's 30mo limit prevents me from disabling HTTP/2. Any suggestions before I move Gotenberg outside Cloudrun are welcome.
TessilimiTheo commentedon Feb 14, 2025
any update or solution?
gulien commentedon Aug 29, 2025
As I don't have any clue of whats happening, I'm waiting for a concrete solution or explanation for re-opening this ticket.
v36u commentedon Mar 2, 2026
My team also encountered this problem:
gotenberg/gotenberg:8-cloudrunWe worked around this by leveraging Gotenberg's capability to download files from provided URLs: https://gotenberg.dev/docs/webhook-download#download-from. So we first upload them to some bucket dedicated for temp files (low retention), and then send the pre-signed URLs to Gotenberg, instead of sending the actual files over the network.
It is important to keep h2c enabled though, because otherwise GCP's response size limit (https://docs.cloud.google.com/run/quotas#request_limits) will kick in and prevent Gotenberg from returning the response -- this appears in Gotenberg's logs as a 500 with no message.
fix(api): advertise a 16 KiB HTTP/2 max frame size (#1700)
feat(image): update image gotenberg/gotenberg (8.38.1 → 8.39.0) (#1021)
feat(container): update image docker.io/gotenberg/gotenberg (8.38.1 ➔…