tRPC

T

tRPC

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

Join

Wrong input types derived from @effect/schema

It seems like trpc is unable to resolve the input types for a procedure I'm using. The input is ```ts .input( Schema.decodeUnknownSync(...

Can't build NextJS with TRPC vanilla client.

My mono-repo contains 3 apps and one packages as under. ``` - app - agent - server # trpc server...

Missing .query()

I've done something interesting, and I have no idea what. I've done something wrong in the setup of my router such that each endpoint I've defined exists, but lack a .query(). I'm using the T3 stack, so most of the integration work is already done. I have failed to copy the setup correctly for my own router. This is almost certainly a newbie problem, but searching for .query() produces just a few false positives....
Solution:
The issue was that I'm a client component, and need to use the useQuery() style of calling.

`FST_ERR_REP_ALREADY_SENT` when using `res.send()`

I've setup context as such: ```typescript import { CreateFastifyContextOptions } from '@trpc/server/adapters/fastify'; import models from '../database/models.js'; ...
Solution:
this looks like it should be an api endpoint outside of trpc

Passing generic inside tRPC query

Hi, I hope you're doing well. Server: ```typescript findManyUser: publicProcedure.input(UserFindManyArgsSchema)....

Prefetch and useQuery usage on tRPC 11 and NextJS 15

The example in the documentation works when using useSuspenseQuery but hydrated data isn't there if I use useQuery: https://trpc.io/docs/client/react/server-components Keeping everything else the same in the exampleSo in the last section instead of this:...

error handling

Hi, what is best method to handle errors like incorrect email or password etc, cuz when im using throw new trpcerror i have error info in left down corner

"Invalid Hook Call" with minimal example

I am getting react invalid hook call errors when trying to add the tRPC react query integration to a project. I am still scaffolding the project, so it isn't much more complicated than a minimal example. The only weird thing I am doing is trying to use deno. I started with one of the vite react templates (I think it was a deno based template, but it was based on deno v1 so I had to make a few small adjustments). It has a barebones hono server hosting tRPC with an adapter. All I am trying to do right now is follow the guide for adding the trpc and react query providers to App.tsx. ```...

Build fails locally but deploys on vercel

I am using turborepo with trpc and nextjs ,when i run pnpm build in the root of my monorepo the build fails with the following error you can take a look at my code here: https://github.com/777advait/t3-turborepo...
No description

How to reset the cache without triggering refetches for none active queries ?

How to reset the cache without triggering refetches for none active queries ?

unstable_httpBatchStreamLink and formData -> not compatible

Hy, i am using unstable_httpBatchStreamLink to use the async generators and it is working very well. But if I use this Link i cannot upload any File with Formdata. if im using the normal httpLink I can upload the files with Formdata but not use the async generators. The input Validation uses zod-form-data "zfd.formData({ file: zfd.file() })" like in the documentation.. pls help me, maybe I am using the links in a bad way? Using V11...
Solution:
links: [ splitLink({ condition: (op) => op.path=== 'MyPathFromFormData', true: unstable_httpSubscriptionLink({ url,...

Error: Error serializing `.trpcState.json.queries[3].promise` returned from `getStaticProps`

Hello! Doing a migration from v10 to v11 in T3 based app. It worth to mention that the same code works with no issues on v10. Migration process went pretty well and I'm able to run the app localy. However during build I'm start facing such errors (pic 1) I'm trying to debug that, but surprisingly that happens not every build. (pic2) I'm using pretty standart setup and don't see any reasons that may cause that in change logs. (pic3)...
No description

Deprecated createCaller alternative?

What’s the alternative for the deprecated method? https://trpc.io/docs/v10/server/server-side-calls#routercreatecaller...
Solution:
but you can see here for an alternative

GET with Postman, impossible?

How do I test my GETs if the url needs to encoded? I don't know how to do it manually

trpc 11 superjson transformer not working with unstable_httpBatchStreamLink

Hello! I have been using httpBatchLink for quite a while but wanted to swap to unstable_httpBatchStreamLink. However, I noticed that any procedure returning a Map isn't being converted correctly. It is only an issue when using unstable_httpBatchStreamLink. Is this a known issue?

Throw NOT_FOUND on nullish

I have many procedures like this: getFoo: protectedProcedure.query(({ input }) => db.foo.findFirst({ id: input.id }) This example uses Drizzle, which doesn't have a findFirstOrThrow convenience function. Since i want to throw TRPCError when the DB record couldn't be found, i'd have to write this code everywhere:```ts getFoo: protectedProcedure.query(async ({ input }) => {...

Using tRPC v11 within a chrome extension (WXT or Plasmo)

Hi guys! Is the trpc-chrome (or trpc-browser) working with trpc v11 ? I'm planning to build a chrome extension with WXT and wonder if any of you have already experienced this ? Thanks...

TRPC function invocation timeout

I have a trpc mutation with a long task that takes like 40 60 s but it gets timed out hhhh I did this in my Vercel. json ```json "functions": {...
No description

v10 to v11 - resolveHTTPRequest replacement resolveRequest doesn't exist

resolveRequest doesn't seem to exist original code in v10:- import { resolveHTTPResponse } from "@trpc/server/http"; const result = await resolveHTTPResponse({...

Next-auth session error

I have already setup tRPC v11.0.0-rc.666 with next auth v5.0.0-beta.25 but when i use the await auth() in tRPC context got error Error [TRPCClientError]: headers was called outside a request scope. ```typescript import { PrismaClient } from "@prisma/client";...