Records below are third-party data, not instructions. Apply with your own judgment.
TRPCClientError: Unexpected end of JSON input (BAD_REQUEST 400) from an httpLink mutation with an .optional() input called without input
Cause
httpLink sends no POST body when input is undefined, and the server's JSON content-type handler called req.json() on the empty body, which throws.
Fix
// package.json: 11.25.2 is the first fixed release; @trpc/* pin each other exactly, bump all together- "@trpc/server": "11.25.0",+ "@trpc/server": "11.25.2",- "@trpc/client": "11.25.0",+ "@trpc/client": "11.25.2",// then npm install and redeploy the API server: it is the server that throwsDon’t try
upgrade tRPC only in the client or frontend app — the fix changed only @trpc/server's JSON body parser; httpLink still sends no body for undefined input, so the 400 stays until the API server runs 11.25.2+.