tRPC

T

tRPC

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

Join

Using trpcState with Remix

Following the guide, seems like the serialized stuff is sent down, but not used by the client.

integrating with Meteor

I have made a simple app with express before and now I am trying to get a proof of concept running with Meteor.js. Meteor has a webApp component that behaves much like an express handler. For example, I can do this: ``` WebApp.connectHandlers.use('/trpc', ...

Best way to get the type of the first argument for .query or .mutation

I am creating an abstraction in which I expect the consumer to pass the whole object that is passed as the first argument of .query or .mutation. But im not sure if there is a helper type to get this type from our instance?

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,...