T
tRPC

trpc.legacyRouterName.procedure "does not exist" on type CreateTRPCNextBase, runs anyway

trpc.legacyRouterName.procedure "does not exist" on type CreateTRPCNextBase, runs anyway

GgwaiLoFi6/7/2023
Have reached the end of a massive trpc 9 -> trpc 10 migration, executed using the official guide with conventions copied from the tRPC Prisma starter. (big thanks to @alex / KATT and @Nick Lucas for your support on here while I frustratingly hacked on our massive codebase) When running legacy procedures such as trpc.tasks.getAllTasks.useQuery(...), .tasks will throw the "does not exist on type CreateTRPCNextBase<Router..." type error, but will run successfully anyway. The only procedures I can see are my v10 router's greeting procedure and router methods such as useContext(). Any insight or direction toward solving this issue would be greatly appreciated! I wonder if this is a result of our legacy middleware?
Nnlucas6/7/2023
“tasks.”? Dot!
GgwaiLoFi6/7/2023
Still not found and that breaks the query methods (e.g. tasks.getTasks or w/e) My router appears to only be getting the typing of mainRouter (trpc 10 router with greeting) from appRouter = mergeRouters(legacyRouter, mainRouter); Since these legacy procedures work (e.g. trpc.tasks.getAll) but are not reflected in typeof appRouter, I wonder if this is a type inference bug with mergeRouters if I do const allTasks = trpc['tasks']['findAll'].useQuery(); for a legacy query I don't get a type error, but that seems like a workaround rather than intended usage I have a standalone query procedure on the legacy router called "health", this and all my other legacy procedures show up as the following on the CreateTRPCNextBase type: queries: MigrateProcedureRecord<RootConfig<{ ctx...}; errorShape: DefaultErrorShape; meta: {}; transformer: DefaultDataTransformer; }>, SwapContext<SwapContext<{}, { ...ctx }>, { ...ctx }> & Record<"health", Procedure<{ ...ctx }, { ...ctx }, {}, undefined, undefined, string, unknown, string>>
Nnlucas6/7/2023
Definitely PEBCAK still, but it’s quite hard to tell from afar I’d be doing lots of hovering over types, and trying to trim down the problem space by commenting routers and maybe exporting the tasks factory result directly as the appRouter just to experiment
GgwaiLoFi6/8/2023
I’ll meet you halfway on PEBCAK, as it would be helpful to see a working example of a legacy router in tRPC 10’s resources in addition to more detail in the v10 migration guide for those of us with robust v9 implementations. Thanks for the suggestion The real answer to this is legacy routers are completely incompatible with CreateTRPCNextBase.

Looking for more? Join the community!

T
tRPC

trpc.legacyRouterName.procedure "does not exist" on type CreateTRPCNextBase, runs anyway

Join Server
Recommended Posts
Not getting legacy router ops in merged tRPC 9 routerFollowed the guide to merge my large tRPC 9 router with tRPC 10, but now I can't use useQuery or acccreateTRPCNext Type Error + useQuery Not DefinedI'm trying to use the conventions for `createTRPCNext ` from https://github.com/trpc/examples-next-pRead response headers on the clientIve been searching for a while trying to figure out how to access response headers on the client. FoIs it possible to access context in input?Hi, I have a validator that requires to get context of prisma in the `input`, Is it possible to get TRPCContextState not found in v10In our v9 app, we used TRPCContextState from internals to type out TRPC utils, importing it like `imRateLimiter for fastify tRPC routesHi, I would like to add Ratelimiter to a specific fastify trpc route, are there any solutions availaSubscriptionsare we able to send data over with subscriptions, to allow for full duplex communication ?Query tRPC the right wayIf you use graphql, you can precisely query what you exactly need and avoid over fetching, so you caHow does trpc subscription actively close/disconnect in the server?How do I actively disconnect my subscription?child router questionlet's say we have a monorepo, one server, two client apps (cat and dog). we make one appRouter, likHow to force SSL on projects using tRPC?Hello everyone, I'm working on a project that uses create-t3-app as boilerplate. My project is hosAWS Lambda / How to set Cookies inside ProceduresHow can I set and remove cookies similar to ctx.res.cookie(..) with Express when using the aws lambdMassive Type Errors on tRPC 10 Legacy Router against MergeRouterWe're trying to upgrade to tRPC 10 but I am running into a massive type clash when trying to merge rIs it possible to create 2 routers inside a single file?I am having an issue in which it is impossible to me to use a class instance within 2 routers. I triUse onError to change an application error into a TRPCError?I want to use the onError handler to change any instance of a custom application error into a TRPCErIncreasing Body 1mb limitHey, Im trying to build an application that allows sending of base64 encoded files to my next.js serNitro and tRPC in vercel-edgeHey there! I hope this is the right place to ask for help. I am trying to deploy an application witHow to retrieve and receive Bigint data to/from TRPC procedureNode: `v16.15.1` I'm trying to return an object which contains an `amount` property from one of my React Router Loaders + tRPC?In Vite project: would it make sense to use React Router loaders with tRPC? I like more the concept TypeError: Cannot read properties of null (reading 'useContext') when using useMutation with TRPC inI'm encountering an error in my Next.js application when trying to use the useMutation hook with TRP