Error on TRPC while fetching data inside Auth.ts

I'm using CredentialsProvider from next auth, and I need to fetch some data to check some data related to the user before I can authorize that user to log in. I have a simple query inside the "authorize" callback, but this throws a TRPC:
input: undefined,
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/httpUtils-f58ceda1.mjs:132:81) {
meta: {},
shape: undefined,
data: undefined,
[cause]: TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11576:11) {
cause: [RequestContentLengthMismatchError]
}
},
input: undefined,
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/httpUtils-f58ceda1.mjs:132:81) {
meta: {},
shape: undefined,
data: undefined,
[cause]: TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11576:11) {
cause: [RequestContentLengthMismatchError]
}
},
Note that the query works fine when I run it in a server component, so I'm a bit unsure what could be the issue here.. Anyone has an idea? Thanks in advance
1 Reply
Mr.T 🐻⛓
Mr.T 🐻⛓9mo ago
Yeh basically it seems like any query within Auth.ts file gets rejected, but the error message is quite vague and it's gonna be hard to debug :/ I ended up getting rid of api. and just did the call from drizzle directly, this works..