Repository navigation
Description
Provide environment information
System:
OS: Linux 5.0 undefined
CPU: (5) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 20.19.1 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.8.2 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
@tanstack/react-query: ^5.90.16 => 5.90.16
@trpc/client: canary => 11.8.2-canary.3+f48ed5c18
@trpc/next: canary => 11.8.2-canary.3+f48ed5c18
@trpc/react-query: canary => 11.8.2-canary.3+f48ed5c18
@trpc/server: canary => 11.8.2-canary.3+f48ed5c18
next: ^15.5.9 => 15.5.9
react: ^19.2.3 => 19.2.3
typescript: ^5.9.3 => 5.9.3
Describe the bug
When I set maxDurationMs in SSEStreamProducerOptions, the subscription becomes idle after maxDurationMs is reached.
I was expecting maxDurationMs to define the maximum duration of a single HTTP request. But I would expect the tRPC client to send a new request to maintain the subscription active.
If stopping the subscription is actually the expected behavior, could you please let me know what is the correct way to configure tRPC subscriptions in a serverless environment (i.e., Vercel), where HTTP requests have a max duration?
My goals are:
-
Limited downtime on reconnect: With the default configuration, tRPC will take some time to "realize" that the HTTP request timed out and then reconnect. During that time, new events are not received. I know I can use tracked events so that I don't miss events. But I'd also like to keep the app responsive as much as possible. I think the solution would be to proactively reconnect before the serverless timeout is reached.
-
No Vercel timeout: I don't want every subscription request to end with a Vercel timeout. That does not sound clean and will get noisy in logs.
Link to reproduction
To reproduce
Just open the reproduction link, let it start and wait to see the subscription become idle.
Additional information
No response
👨👧👦 Contributing
- 🙋♂️ Yes, I'd be down to file a PR fixing this bug!
Activity
fix: SSE subscriptions don't reconnect after maxDurationMs (trpc#7094)
fix: SSE subscriptions don't reconnect after maxDurationMs (trpc#7094)
fix: SSE subscriptions don't reconnect after maxDurationMs (trpc#7094)
fix: SSE subscriptions don't reconnect after maxDurationMs (trpc#7094)
fix: SSE subscriptions don't reconnect after maxDurationMs (trpc#7094)
fix: SSE subscriptions don't reconnect after maxDurationMs (trpc#7094)
fix: SSE subscriptions don't reconnect after maxDurationMs (#7094) (#…
github-actions commentedon Mar 7, 2026
This issue has been locked because we are very unlikely to see comments on closed issues. If you are running into a similar issue, please create a new issue. Thank you.