tRPC

T

tRPC

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

Join

Migrating to V10 from V9

If someone has some ideas on what I might have screwed up when trying to bump tRPC for this public starter please let me know. https://github.com/chamatt/create-kaol-app/pull/7/files...

Authentication broke after bump to v10 from v9

Anyone that has any suggestions on what might have caused this? I get the following error when trying to sign in or sign up.: ``` "Cannot use 'in' operator to search for 'auth.signUp' in undefined"...

Show a spinner when any mutation is loading?

Looking to show an activity spinner in the header of our application whenever a mutation is in flight (Hoping this will be easier than showing it in every conceivable place to say that your request is loading). There might be a few ways to do this, but any recommendations for minimal boilerplate?...

Sharing schemas between server and client

In a typical nextJs setup, what is the idiomatic way to share zod schemas between frontend and backend? Suppose the following use-case: we have a mutation that takes an input: ...

v10 Migration interop, router doesnt have attributes

Hi, i've tried to migrate like stated in the docs, these are my routers. Question: Shouldn't appRouter now have access to the merged routers above?

Recommended file structure for next.js?

Hey all - using tRPC heavily with next.js and it's great. Our main [trpc].ts file is getting huge and unwieldily - wondering what the recommendations are out there for organizing?

Unhandled Runtime ErrorTRPCClientError

Call Stack Function.from node_modules@trpc\client\dist\TRPCClientError-09b8a26b.esm.js (57:0) transformRPCResponse node_modules@trpc\client\dist\httpRequest-62c5cce4.esm.js (15:11)...

Weird error when running unit test

10.0.0-proxy-beta.5 works just fine, error occurs on 10.0.0-proxy-beta.6 with the introduction of @swc/helpers.

Sharing middleware between TRPC servers

We currently have microservices REST API's on Cloudflare Workers and I'm thinking about moving this to TRPC Microservices. We currently have a middleware in a shared package that we can reuse between microservices for authentication, how do I do this within TRPC? How do I define a MiddlewareFunction that can be reused between multiple TRPC instances?...

Is `trpc.withTRPC` for Next supposed to work with pages or only `_app`?

I'd love to only have TRPC mount on certain pages of my Next.js app. Is this currently supported?

TRPClientError

The operation has been aborted at Function. This is the file with the error. The current file is here: https://github.com/makyfj/GymPal/blob/main/src/pages/workout/%5Bid%5D.tsx...

What does the WebSocketHandler do?

I'm not sure what this is doing on the background.

Are there any example of subscriptions working with react native ?

queries and mutations are working pretty well with react native, I'm unable however to get subscriptions to work.

Recommended way to prefetch client-side

In react-query, you can do
queryClient.prefetchQuery(['todos', input], queryFn)
queryClient.prefetchQuery(['todos', input], queryFn)
...

Modifying payload client-side before caching

Say I have a payload that includes something like category_id in each of the items returned e.g.: ``` [ { category_id: 1, ...}, { category_id: 2, ... },...

errorFormatter is not being called?

Could somebody confirm that this callback is called in the latest version? I call it from server side using: const caller = lunaRouter.createCaller({});...

Response headers

Is it possible to modify the response headers from server to client?

API Response caching not working on vercel ⁉

I've followed the instructions in https://trpc.io/docs/v9/caching for API Response caching and it's not working when hosted on vercel. The headers are getting set on localhost which tells me the code is working, but once it's hosted on vercel the cache headers aren't being set. Does anyone have any ideas what's wrong? My code (almost the exact same as the example shown here: https://trpc.io/docs/v9/caching#api-response-caching)...

when throwing a TRPCError, is there a way to include an internal error code ?

for the given screenshot, if such error happens I wanna prompt the user to login or something.