T
tRPC

TypeError: Cannot read properties of null (reading '_def')

TypeError: Cannot read properties of null (reading '_def')

CKCannibal Kush10/24/2023
As the title says, I get the following: TypeError: Cannot read properties of null (reading '_def') at isRouter (/app/node_modules/@trpc/server/dist/config-3ab6b85e.js:52:42) at recursiveGetPaths (/app/node_modules/@trpc/server/dist/config-3ab6b85e.js:84:21) at createRouterInner (/app/node_modules/@trpc/server/dist/config-3ab6b85e.js:94:9) at appRouter (/app/dist/routers/_app.js:19:49) at startServer (/app/dist/server.js:56:20) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) I might have some sort of malconfigured something, but I have no idea where to start looking. Can anyone point me in the right direction?
Nnlucas10/24/2023
Are your trpc versions all the same?
CKCannibal Kush10/24/2023
yeah they are 🤔 i can say it's started happening since we updated from 10.18 -> 10.41 @Nick Lucas sorry for the ping. Basically in 10.18, we had a router definition like fooRouter = __DEV__ ? someRouter() : (null) This actually worked back then and is now breaking.
Nnlucas10/24/2023
Interesting, I don’t think it’s a usage pattern we really were aware of. What happens if instead of null you pass an empty router?
Jjonathanj10/24/2023
Empty router works fine, admittedly null was not a good original choice (my fault).
Nnlucas10/24/2023
That seems the sanest solution then 🙂

Looking for more? Join the community!

T
tRPC

TypeError: Cannot read properties of null (reading '_def')

Join Server
Recommended Posts
I wanna add a localStorage persister, but I'm getting errors for hydration:I wanna add a localStorage persister, but I'm getting errors for hydration: ```js const persister =error route always getting 500 from trpc error? (next13/approuter)I've got this condition for throwing in my trpc procedure: ```ts if (!userClerkProfile) { force-cache planetscale errortrying to use the trpc API from RSCs fails and gives the following error ```log result: { data:What is the pattern for unsubscribing from a subscription?Hi there! I'd like to prevent unnecessary connections to a websocket server across multiple renders.How to add a short delay between requestsEnvironment: nextjs 13, node 18, npm, trpc 10.9.0 I'm wondering if it's possible to add a short delGlobal metadata / filters: Re-validate all queriesHi all, Simple question, I'm looking for the most efficient way to add some global state to all queAttempted import error: 'hashQueryKey' is not exported from '@tanstack/react-query' issuei'm getting this error while trying trpc with latest next version , i tried downgrading but got anotTRPC cant handle ErrorHi, can someone please help me: https://stackoverflow.com/questions/77333318/trpc-handle-trpcerrorI want to create a wrapper for TRPC.init but I can't seem to get the context type correct.I want to get wrap trpc.initTrouble getting a TRPC client in Astro SSR pages, instead I get a noopI'd like to add TRPC to an Astro site. I have an SSR route here (https://github.com/aisflat439/anothWhy webhooks does not work with TRPC?I have a what suppose to be a webhook: ``` deposit: publicProcedure.input(z.any()).mutation(asynctRPC set up errorHey guys, I've been trying to set up tRPC, but unfortunatyy getting this error and it is really unclVercel maxDuration with tRPCHow do you extend extend tRPC timeouts on Vercel? I tried this in `vercel.json`: ```json { "functWhere is client side error handling documented?In the docs, I can only find error handling for the backend. But I want to get the TRPCError code indoes api.myQuery.invalidate() works if the query is not made at the first place?from testing, the invalidate runs the query, but it shouldn't because there is no cache? how do i iworking with custom errors and trpc errorFormatterHey guys. I'm trying to refactor my app so that all errors extend a BaseError class to make dealing