Worker disconnects prematurely when consuming a stream from another worker via RPC
Hi, I have worker A that makes a call to worker B via RPC. Worker B returns a readable stream of bytes and worker A consumes the stream and uses the hono SSE function to stream back the chunks to the client. The client connects using EventSource. This works quite well with requests below 10 seconds.
I have however a rather long task that can take between 1 to 3 minutes to complete and at some stage around 1 minute and half, worker A disconnects prematurely.
This is the error I see
Error: ReadableStream received over RPC disconnected prematurely.
According to the cloudflare docs https://developers.cloudflare.com/workers/platform/limits/#duration there is no duration limit for workers. I am aware of the 30 seconds grace period on deployments but the incidence of that happening is rather low.
Is there a time limit on streams over RPC or worker to worker connections?1 Reply
Thank you for pointing that out, I was just having a look at https://developers.cloudflare.com/api/resources/zones/subresources/settings/models/proxy_read_timeout/#(schema). I have added a heartbeat implementation and that is keeping the connection alive. I must have hit that 100s limit.
Cloudflare API | Zones › Settings › ProxyReadTimeout
Interact with Cloudflare's products and services via the Cloudflare API