Redirect within a trpc procedure

Is it possible to perform redirect within a trpc procedure. I've tried and i just get this error, which sort of makes sense since redirect return a never, which in my head leads to the procedure not returning anything, but has anyone tried to redirect a user by using a trpc procedure without doing it with onSuccess callback on a useMutation hook.

  input: { id: '3lkTiy8jKq13mV3LS3G1' },
  result: TRPCClientError: fetch failed
      at TRPCClientError.from (webpack-internal:///(rsc)/./node_modules/@trpc/client/dist/TRPCClientError-0de4d231.mjs:41:16)
      at eval (webpack-internal:///(rsc)/./node_modules/@trpc/client/dist/httpBatchLink-204206a5.mjs:207:101) {
    meta: undefined,
    shape: undefined,
    data: undefined,
    [cause]: TypeError: fetch failed
        at Object.fetch (node:internal/deps/undici/undici:12789:11) {
      cause: [RequestContentLengthMismatchError]
    }
  },
  elapsedMs: 13
}
 ⨯ node_modules/@trpc/client/dist/TRPCClientError-0de4d231.mjs (37:15) @ TRPCClientError.from
 ⨯ Internal error: TRPCClientError: fetch failed
    at TRPCClientError.from (./node_modules/@trpc/client/dist/TRPCClientError-0de4d231.mjs:41:16)
    at eval (./node_modules/@trpc/client/dist/httpBatchLink-204206a5.mjs:207:101)
Cause: TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:12789:11) {
  cause: RequestContentLengthMismatchError: Request body length does not match content-length header
      at write (/home/hermann/portfolio/cv-tracker/cv-tracker-app-dir/node_modules/next/dist/compiled/undici/index.js:1:74596)
      at _resume (/home/hermann/portfolio/cv-tracker/cv-tracker-app-dir/node_modules/next/dist/compiled/undici/index.js:1:74173)
      at resume (/home/hermann/portfolio/cv-tracker/cv-tracker-app-dir/node_modules/next/dist/compiled/undici/index.js:1:72829)
      at connect (/home/hermann/portfolio/cv-tracker/cv-tracker-app-dir/node_modules/next/dist/compiled/undici/index.js:1:72717) {
    code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH'
  }
}
Was this page helpful?