Error with v11 when using batching

I'm using the lastest version of v11. When I use the batch link I get an trpc inernal error when batched request are received. I'm using HonoJS, bun and v11. Stack trace:
TRPCError: Body already used
code: "PARSE_ERROR"
at new TRPCError (/usr/src/app/node_modules/@trpc/server/dist/unstable-core-do-not-import/error/TRPCError.mjs:51:9)
at /usr/src/app/node_modules/@trpc/server/dist/adapters/fetch/content-type/json/index.mjs:28:27
16 | if (!input) {
17 | return undefined;
18 | }
19 | return JSON.parse(input);
20 | }
21 | const body = opts.req.headers.get('content-type')?.startsWith('application/json') ? await opts.req.text() : '';
^
error: Body already used
at /usr/src/app/node_modules/@trpc/server/dist/adapters/fetch/content-type/json/index.mjs:21:111
at getRawProcedureInputOrThrow (/usr/src/app/node_modules/@trpc/server/dist/adapters/fetch/content-type/json/index.mjs:11:58)
at /usr/src/app/node_modules/@trpc/server/dist/adapters/fetch/content-type/json/index.mjs:37:36
at getInputs (/usr/src/app/node_modules/@trpc/server/dist/adapters/fetch/content-type/json/index.mjs:10:27)
at /usr/src/app/node_modules/@trpc/server/dist/adapters/fetch/fetchRequestHandler.mjs:104:26
at getInput (/usr/src/app/node_modules/@trpc/server/dist/adapters/fetch/fetchRequestHandler.mjs:103:25)
at /usr/src/app/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/resolveHTTPResponse.mjs:113:45
at getRawInputForBatch (/usr/src/app/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/resolveHTTPResponse.mjs:111:44)
at /usr/src/app/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/resolveHTTPResponse.mjs:136:30
TRPCError: Body already used
code: "PARSE_ERROR"
at new TRPCError (/usr/src/app/node_modules/@trpc/server/dist/unstable-core-do-not-import/error/TRPCError.mjs:51:9)
at /usr/src/app/node_modules/@trpc/server/dist/adapters/fetch/content-type/json/index.mjs:28:27
16 | if (!input) {
17 | return undefined;
18 | }
19 | return JSON.parse(input);
20 | }
21 | const body = opts.req.headers.get('content-type')?.startsWith('application/json') ? await opts.req.text() : '';
^
error: Body already used
at /usr/src/app/node_modules/@trpc/server/dist/adapters/fetch/content-type/json/index.mjs:21:111
at getRawProcedureInputOrThrow (/usr/src/app/node_modules/@trpc/server/dist/adapters/fetch/content-type/json/index.mjs:11:58)
at /usr/src/app/node_modules/@trpc/server/dist/adapters/fetch/content-type/json/index.mjs:37:36
at getInputs (/usr/src/app/node_modules/@trpc/server/dist/adapters/fetch/content-type/json/index.mjs:10:27)
at /usr/src/app/node_modules/@trpc/server/dist/adapters/fetch/fetchRequestHandler.mjs:104:26
at getInput (/usr/src/app/node_modules/@trpc/server/dist/adapters/fetch/fetchRequestHandler.mjs:103:25)
at /usr/src/app/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/resolveHTTPResponse.mjs:113:45
at getRawInputForBatch (/usr/src/app/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/resolveHTTPResponse.mjs:111:44)
at /usr/src/app/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/resolveHTTPResponse.mjs:136:30
For now i disabled it. Is there a better long term solution?
N
Nick16d ago
Thanks, could you raise a bug ticket along with a small reproduction? I have a good idea what’s causing this and falling back to your last working release should be fine
E
Elven16d ago
Thanks. I don't have a previously working release with it working, I've just set up trpc.
I'm not sure I will have time to make a repro in the next few days/weeks unfortunately. Will try when I can.
N
Nick16d ago
If you can share details about your tRPC setup on the server that would be perfect
AK
Alex / KATT 🐱16d ago
No stress about exact reproduction, but if you've just setup trpc maybe you could give us the steps you followed roughly? We just released some new features that seem to create issues in your setup even though we thought our tests covered all edge cases I was able to reproduce this and rolled back the code caused it 11.0.0-rc.351 should be good
E
Elven14d ago
Thank you very much for the quick reaction !
More Posts
tRPC failed on <no-path>: `headers` was called outside a request scopeI'm using NPM GET /api/trpc/post.test?batch=1&input=%7B%220%22%3A%7B%22json%22%3Anull%2C%22meta%22%v11 `Invalid Content-Type header`The most recent update of v11 seems to break with: ``` Invalid Content-Type header. This request mayCalling procedures from Next server actionsHi, is using trpc client allowed in server actions? I have two use cases, in one i call procedure frTRPC Typescript auto serialize errorThe inferred type of this node exceeds the maximum length the compiler will serialize. An explicit tTRPC with MSWDoes anyone have a basic example on how to set up MSW in a React Vite TRPC env? My main question isRevalidate / invalidate in server componentsIs there a solution for TRPC query invalidation (or revalidating), passing the actions from the clieTypescript type error with latest versionI'm initialising a project with trpc v11 and I'm trying to strictly follow the documentation for reaDon't understand cacheHow come my API is still getting called when it's already been called with other inputs? Ex: 1. api The inferred type of this node exceeds the maximum length the compiler will serialize.I'm facing this issue. The inferred type of this node exceeds the maximum length the compiler will sGetting strange react error in nextjsI am getting a strange Error Message when nextjs tries to compile: ```js TypeError: react__WEBPACK_Error on NextJs AppRouterAnyone knows why this is showing on my console?TRPC Dynamic Procedure URLI am currently using QStash as a message queue with TRPC. QStash is HTTP-based and in the example beIs it possible to get the procedure name / id in middleware?I want to create a caching middleware that in some routes, stores a cache key that contains the routqueries and mutations has wrong response type in client ( monorepo )tRPC + React Query Data Invalidation?Hey y'all, I'm working with tRPC and React Query and just trying to understand how this works. I havtrpc optimistic updates causing data flickerI'm trying to add optimistic updates to a calendar component but when the mutate function is called > Error: Invariant: headers() expects to have requestAsyncStorage, none availableHi, I use trpc v1045.1 in next 14.1 app router. I call it server side and have the following. ```js How do I exclude properties while returning data?I basically need to create a dto's that would exclude properties like access keys etc. while returni