tRPC

T

tRPC

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

Join

is it possible to send error codes that aren't listed (eg 503 - service unavailable)

When creating a TRPCError you can specify a code out of the ones listed on the docs But out of these, the only 5xx error is internal server error. I would like to send a 503 to indicate that the request was properly formatted, but the server isn't ready to handle it yet. It's not necessarily a server error....

Next 14 app router

Is there any docs for NextJS 14 app router integration ?

experimental_nextAppDirCaller ERROR

Hey y'all 🙂 I'm reading new blog post by @julius about TRCP with Next Server Actions approach. Was following the steps to use ...

Generic query type

Does TRPC offer a generic query type? I am thinking of a type where I can control the input/output interface, and then be allowed to pass any query with those interfaces?

How to prevent leaking error messages to client?

Hey everyone! I noticed that TRPC seems to log quite extensive error codes in the response body of failed requests, even in production builds. I really don't want my users to be able to see e.g. Error: connect ECONNREFUSED 10.1.0.6:5432\n at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)\n Thanks!...
No description

TRPC NUXT req run 2 times(on server and client)

Hi everyone, I have a problem using DataCache in SSR. I am using this function to "GET" my plan. But every time I navigate to this page, I see an http request. It's like the data is not being cached......
No description

405 error

this is my set up
No description

useUtils().setQueriesData should not take input as param.

In react query spec, setQueriesData takes filters and updater as parameters. For me it does not make sense to have a required input param since it targets a specific query. What's the difference with setQueryData ?...

client unable to infer output types

I'm using v11 of trpc in tandem with drizzle on my backend. The client is a react native app. I've spent several hours trying to figure out why my outputs are inferred as Any. when I check the type on the backend I get the correct type so it's only happening on the client. for example product.list is a drizzle query that return an array of product but this is what I get. ```type LIST /* LIST is Any */ = RouterOutputs["product"]["list"];...

How to access the request body in the onError callback?

Hi 👋 I'm having trouble getting the request's body (probably plain text) when the following error occurs in the fetchRequestHandler: ``` TRPCError: "input" needs to be an object when doing a batch call...

Make meta in react-query type-safe.

So right now I have to write something like ```typescript *.useQuery({}, { meta: { mfa: false...

Using tRPC (createCallerFactory) with react-query.

Hey guys. Do you know any recipe that would make that approach possible? I'm receiving following error: Property 'runtime' is missing in type 'DecoratedProcedureRecord<{ subscribe: Router<{ _config: RootConfig<{ ctx: RevPopClientContext; meta: object; errorShape: DefaultErrorShape; transformer: DefaultDataTransformer; }>; ... 5 more ...; subscriptions: {}; }> & { ...; }; }> & { ...; }' but required in type 'TRPCClient<Router<{ _config: RootConfig<{ ctx: RevPopClientContext; meta: object; errorShape: DefaultErrorShape; transformer: DefaultDataTransformer; }>; ... 5 more ...; subscriptions: {}; }> & { ...; }>'.ts(2741) createTRPCClient.d.ts(11, 14): 'runtime' is declared here....
No description

Losing type-safety with merged routers

When using router exported from an external file, I lose any sort of type safety for the procedures on in that router. router.ts ```ts export const appRouter = router({...

Send File Back From Procedure

Is there a way to send content like this back from a tRPC procedure? ```ts const headers = { "Content-Type": "application/vnd.apple.pkpass",...

anyone used combine function on useQueries? I can't figure where to place it in case of tRPC

I can't figure out where to pass combine function inside tRPCs useQueries implementation

conditional useQuery without input

How to use the enabled option for useQuery that doesn't has an input? ``` const { isError, error } = trpc.iam.logout.useQuery(undefined, { enabled: isEnabled,...

trpc query help

With trpc on the client side lets say I have a form component that creates a post and also a list component which displays the post on the same page, When I create a post, how do I make this list that displays the post refresh. I'm working with nextjs btw

change data from query

There is a page in which I make a query for a list of codes, and on that page you can also generate one, how do I change the data to update the list on the page without refetching?

How do I set header value from localStorage or Zustand in tRPC and React?

Hello, This is my tRPC client in my App.tsx: ```ts function App(): JSX.Element {...