Email Workers Message.reply() Timeout (~30s)
Hey there! I’m trying to process an inbound email, make a long-running RPC to Browser Render (which might take 1–2 minutes), then reply to the sender using message.reply(). My issue is that Message.reply() is no longer allowed after ~30 seconds - the event window just closes. Is there any way to defer a message.reply() or park the reply until after the async work? I'd like to avoid having to use env.EMAIL.send() due to recipient verification. Any ideas?
1 Reply
Hello! Did you consider DO to keep the sessions and speed things up? That might help with maintaining the state of message as well https://developers.cloudflare.com/browser-rendering/workers-binding-api/reuse-sessions/
Cloudflare Docs
Reuse sessions
The best way to improve the performance of your browser rendering Worker is to reuse sessions. One way to do that is via Durable Objects, which allows you to keep a long running connection from a Worker to a browser. Another way is to keep the browser open after you've finished with it, and connect to that session each time you have a new request.