tRPC

T

tRPC

Join the community to ask questions about tRPC and get answers from other members.

Join

When upgrading to v11, the AppRouter in .d.ts is any

Hello ! I just tried to upgrade from trpc v10 to trpc v11. I am on a monrepo, the the tRPC router type is built as part of a package. ...

Does batch streaming get counted as a single function invocation on Vercel?

I'm wondering if the batched http call gets counted as one on vercel?

how can I set up trpc to work with nested providers?

Hi, I have two separate clients with their own typings and HTTP links, and I wrap my application in nested providers—one for each client—with their own QueryClient instances. However, regardless of which client I use, the runtime always sends the request to the URL specified in the innermost provider. The typings and client definitions appear correct, but at runtime both clients' queries are routed to the endpoint of the innermost provider. ...
No description

Calling endpoint within another endpoint

Hi, I need to get the result of one of my endpoints, but I can't just call the underlying function directly — because every endpoint is wrapped with security and middleware before being exposed through the tRPC appRouter. So instead of bypassing those layers, I need to trigger the full chain — essentially making a proper call to the endpoint itself (as if it were external), even from inside another tRPC procedure. ...

[Typescript] Client query / mutate has any type

I've broken my tRPC routes into separate modules and combined them using mergeRouters, but that seems to have broken type-safety on the client. Now, trpc is showing up as any, and I’ve lost all autocomplete and type hints for available procedures. Things I’ve checked: - I’ve gone through the tRPC FAQ and verified everything listed. - Types were working fine (only for health-check procedures though) before I split and merged the routers ...
No description

What do you call the function that is used by a procedure?

Hey all! I'm making a small style guide for my team and was wondering what to call the actual function that is passed to procedures... should I also call it a procedure?

wsLink with external (custom) websocket?

I want to integrate an external websocket to tRPC for extra type-safety with wsLink where the url will need to be dynamic and the authentication as well. The problem is as follows: 1) The websocket url is dynamic. It needs to be requested through an API first to get it, because the system has multiple nodes with different ports....

Error trying to serve TRPC from custom path in Hono

I'm successfully serving a basic "hello world" using the default root path: ```proxyApp.use("/trpc/*", trpcServer({ router: appRouter,...

Next JS error handling.

I'm having this weird error in Next dev whenever I throw an error in a router. ``` login: publicProcedure.input(loginSchema).mutation(async ({ ctx, input }) => { const { error } = await ctx.supabase.auth.signInWithPassword({...
No description

bigint

My trpc client is showing type never for bigints. How can I fix this? Thanks...

trpc+solidjs

I've been happily using trpc v10 with solidjs. now that v11 is officially out, what's the best way to use trpc with solid? is the vanilla client + manual tanstack query integration the way to go?

Best way to wrap procedure for error handling

Wondering what's the most idiomatic way to accomplish this? I want to have a try { } catch {} that wraps each procedure and returns a generic error for uncaught (non trpc) errors It is to just created a wrapper fn ie withErrorHandling that you wrap all your procedures with? ...

procedures on routers are typed any

I'm using the better-t-stack. It also uses turborepo for trpc.
No description

Inferring Types not working as expected

Hi guys, For some reason inferRouterOutputs is not working as expected for me. Environment: react-native, bun, trpc 11...

Error: Switched to client rendering because the server rendering errored: UNAUTHORIZED

What could be the possible reason for this error? This is how my NextJS structure looks when using tRPC. - /app/settings/page.tsx...
No description

Max number of subscriptions

Hello, I hope you can help me. I have a nextjs app with a realtime chat and I've just switched to sse (like in the example repo in the docs) from a standalone ws server. I've implemented various subscriptions, onAdd, onEdit, onDelete, onType and so on. Everithing works on their own but when i try to enable more then 5 subscriptions at the same time the page breaks ( no longer receiving mutation response, no longer able to reload the page, some external api is left pending) . Is there a limit of subscriptions i can run simultaneously? I already have solved the problem consolidating in 2 or 3 subscriptions the whole logic and it works no problem. It would be nice to know if there is a limit tho. Thanks 😃 running on node 22.14 with npm and nextjs v15.3...

TRPCError: Unsupported GET-request to mutation procedure at path

Hi, since I upgraded to TRPC v11 and React Query v5 with the classic integration, I suddenly get lots of errors like these: TRPCError: Unsupported GET-request to mutation procedure at path "app.trackMetric" ...

Context and TanStack

I am having trouble creating the appropriate context with the tanstack query client. The documentation says to use a type that asks for a NextApiResponse but all I can get is a plain NextResponse. Is there something I'm missing?

TRPC 11 Classic React Query custom hook

This is how I was able to refactor one of the custom hooks I had before, typescript threw an error ofc. old approach ```export const useGlassDiameters = < T extends DecoratedQuery<{...
Next