Skip to content

tRPC mutations hang if request body already read #5534

Closed

Description

@aseemk

Area of Improvement

Hi there. Thanks for such a great library!

I hit an issue trying to use it for the first time, where queries worked but mutations would hang indefinitely, and never execute my actual procedure (function).

I managed to figure it out, but thought it might be worth documenting this more explicitly, to save others the hours of debugging.

The cause was that:

  • Mutation inputs come through the request body (whereas query string inputs come through the query string)

  • tRPC's Node HTTP adapter (which other adapters, like this Koa adapter I'm using, wrap) thus attempts to read/stream the request body

  • But I was already using another middleware to read/stream request bodies for other uses in my app.

So tRPC was indefinitely waiting around for data and end events that never came.

Fortunately, tRPC's Node HTTP adapter does support the native Node request already having a body property set. And in my case, the other middleware I'm using does provide an option to add this property to the native Node request (in addition to the Koa context's request).

So consider documenting this important detail and gotcha, whether in the adapters page(s) and/or the troubleshooting page.

Thanks and hope this helps others!

Link to related docs

No response

Additional information

No response

👨‍👧‍👦 Contributing

  • 🙋‍♂️ Yes, I'd be down to file a PR implementing the suggested changes!

Activity

  1. added
    📚 documentation / examples
    on Mar 3, 2024
  2. KATT commented on Mar 3, 2024

    @KATT
    Member

    Where would you think this should be documented? Feel free to just click edit on some of the pages on the trpc docs and submit a pr

  3. added a commit that references this issue on Oct 20, 2026
    55b228d
  4. github-actions commented on Oct 21, 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.

  5. locked as resolved and limited conversation to collaborators on Oct 21, 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

    📚 documentation / examples

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions