tRPC

T

tRPC

Move Fast & Break Nothing. End-to-end typesafe APIs made easy.

Join

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.
Solution:
Hi @Khojo & @ToolReaz I've made an issue to the official repository. Feel free to follow along and try the suggestions other said. https://github.com/AmanVarshney01/create-better-t-stack/issues/177...
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<{...

signup/signin

I'm using theo's t3 stack and i'm wondering about user authentication. When signing in or up users, should i prefer nextjs's server actions or trpc ?...

Pre-rendering Error with TRPC useSuspenseQuery – "fetch failed" During Build

Summary During the build process, the application attempts to pre-render the page containing the Greeting component. Since the component uses useSuspenseQuery to call a TRPC endpoint, pre-rendering triggers the call and results in a "fetch failed" error because the route isn’t available during build time. Known workarounds—switching to useQuery or using prefetch on the page component—prevent the error; however, these solutions are not acceptable in this case. Code Samples...

Throwing error in trpc route, continuously sending a request

I tried to change to protectedProcedure on hello router to see if the Suspense and ErrorBoundary is working. As you can see on my network tab I already have a thousands request, I followed the Tanstack React Query/Server Components . And for the other screenshot that I provided, those are the only changes I made....
No description

Error using prefetch query with TanStack Query

When trying to prefetch data with TanStack Query it fails with the following:
A query that was dehydrated as pending ended up rejecting. [[["tradeList"],{"type":"query"}]]: TypeError: (0 , __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f2e$pnpm$2f$next$40$15$2e$3$2e$0_react$2d$dom$40$19$2e$1$2e$0_react$40$19$2e$1$2e$0_$5f$react$40$19$2e$1$2e$0$2f$node_modules$2f$next$2f$dist$2f$server$2f$route$2d$modules$2f$app$2d$page$2f$vendored$2f$rsc$2f$react$2e$js__$5b$app$2d$rsc$5d$__$28$ecmascript$29$__.createContext) is not a function; The error will be redacted in production builds
⨯ [Error: redacted] { digest: '2062921512' }
A query that was dehydrated as pending ended up rejecting. [[["tradeList"],{"type":"query"}]]: TypeError: (0 , __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f2e$pnpm$2f$next$40$15$2e$3$2e$0_react$2d$dom$40$19$2e$1$2e$0_react$40$19$2e$1$2e$0_$5f$react$40$19$2e$1$2e$0$2f$node_modules$2f$next$2f$dist$2f$server$2f$route$2d$modules$2f$app$2d$page$2f$vendored$2f$rsc$2f$react$2e$js__$5b$app$2d$rsc$5d$__$28$ecmascript$29$__.createContext) is not a function; The error will be redacted in production builds
⨯ [Error: redacted] { digest: '2062921512' }
...

CreateCaller for router with AWS Adapters

Hey - I'm trying to make a create caller. But I'm unsure how I am supposed to pass the correct context information into the create caller. Seemingly no matter what I try it to pass into the createCaller() - it gives me a long error :/...
No description

Wrong type for results

I have a query that has a couple fields with the Date type, however when queried with TanStack they are being returned as string. Is there a way to cast them to Date again?
Solution:
Afaik you need to use a transformer https://trpc.io/docs/server/data-transformers...

Query invalidation per mutation-key

I just learned about query invalidation using the classic implementation, and that it provides an option to invalidate all queries on every mutation (https://trpc.io/docs/client/react/useUtils#invalidate-full-cache-on-every-mutation). I haven't followed up on the possibilities the new TanStack React Query provides, but I was just about asking whether it's possible to also get the key of the mutation in the general function. I would like to have some central place, where I register that every mutation on key X should invalidate query Y and Z. I would like to skip having to remember this every time I write a mutation, but I still want to be more specific that just reloading everything on a mutation. Hope my request is understandable 😅 I'm myself just getting warm with this lib, but I like it a lot already ♥️...

Blob as response tRPC v.11

Hi! According to https://trpc.io/blog/announcing-trpc-v11#formdata--non-json-content-types-support it should now be possible to return blobs. How? I have not been able to make it work and i have not found any blob response examples. Of note is that we are also using the express adapter from @trpc/server/adapters/express Thanks!...

How can I access the session in fastify when using `useWSS: true`?

I've got a fastify/trpc application that looks something like this: ```typescript await using app = Fastify({ loggerInstance: logger,...
Solution:
Hi @Mr. Joker, I ended up writing my solution up on my blog, you can read that here: https://jonathan-frere.com/posts/trpc-fastify-websockets/ Specifically, the solution I found was this: ```typescript...