TRPC Error does not say router path
Hello,
I have a tRPC client that sometimes fails to call my procedures/queries. I have many of them and find difficult to track back the router path that failed. Am I missing something? In the stacktrace I only get this:
TRPCClientError: Unexpected token 'A', "An error o"... is not valid JSON
at TRPCClientError.from (file:///voice/nodemodules/.pnpm/@trpc+client@11.0.0-rc.364@trpc+server@11.0.0-rc.364/node_modules/@trpc/client/dist/TRPCClientError.mjs:37:16)
at file:///voice/nodemodules/.pnpm/@trpc+client@11.0.0-rc.364@trpc+server@11.0.0-rc.364/node_modules/@trpc/client/dist/links/internals/httpUtils.mjs:138:36
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
meta: {
response: Response {
[Symbol(realm)]: null,
[Symbol(state)]: [Object],
[Symbol(headers)]: [HeadersList]
}
},
shape: undefined,
data: undefined,
[cause]: SyntaxError: Unexpected token 'A', "An error o"... is not valid JSON
at JSON.parse (<anonymous>)
at parseJSONFromBytes (node:internal/deps/undici/undici:5584:19)
at successSteps (node:internal/deps/undici/undici:5555:27)
at fullyReadBody (node:internal/deps/undici/undici:1665:9)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async specConsumeBody (node:internal/deps/undici/undici:5564:7)
11 Replies
Don't you get the error in console or in the network tab? From there you should see the path
it should look something like POST http://localhost..../path.to.api
I log the error and that is what I get :/
don't youy see something like that? probably you have them hidden
I do no have access to the browser console log. The logs are in production. I catch the error and then console.log(error)
is this a mutation?
I do not know! I have mutations and queries
ah hold on, you don't know which one gives errors, did i understand correctly?
Seems wrong that the path information is not included in the error Object. Is there a way to include it? Maybe in the config?
bot sure because i always see them. Maybe it doesnt work in production only
I have catch on every mutation/query and console log the error (Which I then save in cloudwatch)
Maybe I got it, tha path information is probably inside [Object]