Workers wall clock timeout (524) at 10 seconds
According to the docs workers don't have duration limits (docs) but I'm getting 524s every time wall clock exceeds 100 seconds. Are the docs wrong or am I doing something wrong? EDIT 100 seconds not 10
4 Replies
Docs are correct. 524 though is a CDN limit where we timeout after 100s if there is no response sent
https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/error-524/
What are you doing to not send a response in 100 seconds? Can you stream back?
Thank you. Not really unfortunately. This is a router to a reasoning model that can take a long time. We have a streaming option but some users need non-streaming
Can we turn off the CDN for this worker?
Is there a way to send a heartbeat/ping to the CDN so it doesn't close the connection?
The cdn is what runs Workers so no, depending on the zone plan you may be able to increase the timeout (https://developers.cloudflare.com/fundamentals/reference/connection-limits/#between-cloudflare-and-origin-server)
otherwise, best you can do is stream the response or try and reduce the wait time
Can the AI Gateway product help?
I have the same issue with AI endpoints being slow and not streaming. Another idea I had was to use Worker Containers to proxy the request and send heartbeat back to my main worker