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'
}
}
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'
}
}
2 Replies
West side ⁉
West side ⁉15mo ago
ayyyee using lucia too? 'cause I'm facing the same hell rn I think we're not supposed to edit those headers trpc will only return the json or whatever we specify, disregarding headers so maybe return your cookie within your response and then modify it from client side? idk
The cokeaine is too good
Im trying to use trpc within server action which is bound to be a bit unstable😂
Want results from more Discord servers?
Add your server