koko#1337K
tRPC3y ago
1 reply
koko#1337

TRPCClientError: fetch failed

I get the below error when createTRPCProxyClient runs on BE of a Next.JS app hosted on Vercel:

TRPCClientError: fetch failed
    at TRPCClientError.from (file:///var/task/node_modules/@trpc/client/dist/transformResult-9a244fe7.mjs:13:16)
    at file:///var/task/node_modules/@trpc/client/dist/links/httpBatchLink.mjs:211:64 {
  meta: undefined,
  shape: undefined,
  data: undefined,
  [cause]: TypeError: fetch failed
      at Object.fetch (node:internal/deps/undici/undici:11413:11) {
    cause: RequestContentLengthMismatchError: Request body length does not match content-length header
        at AsyncWriter.end (node:internal/deps/undici/undici:10197:19)
        at writeIterable (node:internal/deps/undici/undici:10107:16)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
      code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH'
    }
  }
}



I've been struggling for a while, and have no clue what's going on. Anybody experienced something similar? It seems to be coming from undici polyfilling fetch for node, but that's as far as I can go before the guessing game begins.


This is not happening locally
Was this page helpful?