Skip to content

bug: No reconnect after maxDurationMs #7094

Closed

Description

@testerez

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:

  1. 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.

  2. 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

https://stackblitz.com/edit/github-rmw4rvvn-3umdr23r?file=src%2Fpages%2Fapi%2Ftrpc%2F[trpc].ts

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

  1. added
    🐛 bug
    and removed on Mar 5, 2026
  2. github-actions commented on Mar 7, 2026

    @github-actions
    Contributor

    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.

  3. locked as resolved and limited conversation to collaborators on Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions