tRPC

T

tRPC

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

Join

Using HTTP:POST for `query`?

Hey guys, thanks for the awesome library! My application involves making a query with a large amount of JSON data. However, since we use HTTP:GET under-the-hood for queries ( including batching ), I run into header length limits. Since we deploy to AWS, we are also restricted to the length limit imposed by Amazon ALB. Due to this, I have the following questions : - Is it currently possible to use HTTP:POST for query and mutation? ...

re validation on static site next js 13

Hi, does any one know how to make revaluation when I’m fetching data on the server client from DB with usage of trpc react query? import AddTodo from '@/app/(routes)/(account)/todo/_components/AddTodo' import { TodoList } from '@/app/_components' import { serverClient } from '@/app/_utils/api/serverClient'...

Transformers not transforming data (trpc-sveltekit)

I'm having some trouble getting superjson to do its magic with tRPC & SvelteKit. I have a client.ts file that looks like this: ```ts import superjson from 'superjson'; import { type TRPCClientInit, createTRPCClient } from 'trpc-sveltekit';...

Issue Inferring Type on Frontend with ElectroDB Query Return Statement

Hi all, I am using ElectroDB to work with DynamoDB, and I have a Lambda function that uses tRPC that uses ElectroDB commands to read/write to my database. I have a weird situation where the backend tRPC can infer the return type properly from my ElectroDB queries, but on the frontend (React), it says that the useQuery() response is of type any ...
No description

Wrong JSON response when deployed

When testing in localhost in dev mode there is no issue and the response is correct as expected. But when deployed, I get a weird JSON response with numbers. (see image). This results in a client side error because it cannot be parsed correct....
No description

External calls

Hi! I am using T3 stack, tRPC together with clerk, and i need to create users within the app, being already logged in, so i need to use external API, quiestion is, what are best practices, doing external API calls inside trpc route? or do it on component side

Need help identifying the generic client side type of procedures

Hi! I think my question is better explained by what I'm trying to achive than anything else: I like to create a function called "subscribe" that can receive any subscription procedure and subscribe to it:...

Is there a way to use versioning for procedures?

I want to make multiple versions (v1 / v2) for a procedure, can i do it in procedure level?

createSSGHelpers

I'm trying to fetch data in getStaticProps and getting the issue "Promise<{ paths: { params: { id: number; }; }[]; fallback: "blocking"; }>' is not assignable to type 'GetStaticPaths" Wondering how to appropietly (without using deprecated functions) do SSR with trpc in nextjs. ```js...

TRPC undefined when exporting

Hi i am working on merging routers from different files but when exporting the router property it comes out as undefined. This is the current code for it ```ts...

TRPC retries with new app dir

let { data: name, isLoading, isFetching, isError, error } = trpc.home.home.useQuery();
let { data: name, isLoading, isFetching, isError, error } = trpc.home.home.useQuery();
I am using React query with App directory in next js , can somebody tell me how can i aplly retry:1 , because by default it is set to 3...

opts.input is of type undifined

```ts register: publicProcedure.input( RegisterSchema ).mutation(async (opts) => { //checking for existing user...

Server-side error tracing with Datadog

Hey, has anyone had any luck setting up tracing with tRPC? Specifically with dd-trace-js. We’re using Datadog and because tRPC handles all errors internally, the tracer doesn’t actually get access to the stack trace. Likewise, it stops creating spans before hitting the tRPC route and only resumes if any library underneath is instrumented....

Configuration help

Hello! I want to apply the following configuration on the client: https://tanstack.com/query/v4/docs/react/guides/window-focus-refetching ...

I'm curious to know if anyone has any suggestions on how I can track the replies to the emails

I'm curious to know if anyone has any suggestions on how I can track the replies to the emails I send programmatically. Basically, I want to know if there's a way to keep track of when someone replies to an email I've sent through my program

tRPC subscription : Access to socket ID from subscription

I'm trying to implement user online status in a reliable way on my app, on the "live" part of my app. It's done & working well, but on some cases where the connexion is cut & not restored, I can't trigger the mutation marking the user offline. Right now I'm handling this through the client only right now but in some instances, it's not reliable. What I'd like to do would be something like this : (For subscription I need to pass my authToken as an input since wsLink does not support dynamic header resolver yet to my knowledge)....

Having Issue With Context in App Directory Next.js

I am having an issue with creatin the trpc context with both the session and prisma. I am trying to use the next 13 app directory and know it has been changed due to how the new api folder works. Using a publicProceedure works properly, but that protectedProcedure says unauthorized. I am using nextauth too...
No description

tRPC querying data via function not working

In the below code, fetchSocialMediaData is logging themeId but, not response, getting error as mentioned in the screenshot attached. Is there anything I missed from docs? Correct me wherever I am wrong. ```tsx type SocialMediaData = { id: string;...
No description

Next.js app router + TRPC...how to set it up?

Note You can already use tRPC with app directory, by:
>
- using @trpc/client directly in components (both RSC and non-RSC) - use @trpc/next for client components...

How do I setup App router + TRPC + Lucia Auth? (protected routes)

I'm trying to setup tRPC with Lucia in app router but I struggle to make protected routes work. I made a trpc context where I put lucia session and a getDefaultSession function to get the session ```ts...