You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tRPC mutations hang if request body already read #5534
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)
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!
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.
Activity
KATT commentedon Mar 3, 2024
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
fix(server): don't hang when the node request body was already consum…
github-actions commentedon Oct 21, 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.