tRPC

T

tRPC

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

Join

The inferred type of 'trpc' cannot be named without a reference to '...'

I have a monorepo setup like this: root -tsconfig.json -frontend...

Update a query with setData avoid calling invalidateQueries ?

I have this code, which is cancelling all the queries for an specific router, then it's updating the cache, then it's doing a mutation. I have this global overrides, but when i have this setData logic, it's not fetching again the data, when i comment that part, it's refetching. Is this the normal behavior?
No description

sending messages via WebSockets

Hi, do I have the possibility to send messages via wsLink? I want to connect to Binance and be able to place orders via WebSockets, so far I've only been receiving market data like so: ``` useEffect(() => { const socket = client.binance.marketDataStream.subscribe( { symbol },...

My TRPC hooks are getting typed as `any`

I'm using a Typescript + Express backend (Node.js, version 18), and a React Native (Typescript) frontend. For some reason by TRPC tanstack-query hooks don't seem to be typing things correctly. I am trying to understand why. I have a monorepo setup with a file structure like this: root...

Subscription error: TRPCClientError: Subscriptions should use wsLink

this is my trpc client: ```js export const trpc = createTRPCNext<AppRouter>({ /** * @link https://trpc.io/docs/v11/ssr...

tRPC typings not working - Cannot import @trpc/server on client

hi guys, my structure is the following: - Turborepo TS compiling to cjs - A common packcage which defines the tRPC router - A server service which imports it & runs on expressjs...

tRPC deployed with Amazon API Gateway adapter, SST Ion, and Clerk auth

I am going through this https://ion.sst.dev/docs/start/aws/trpc/, but I don't know the best way to pass auth() from server Next.js to awsLambdaRequestHandler. ```ts return createTRPCContext({ event: ? // pass event.headers: heads?...

TRPC with Turborepo Nextjs

Do you guys usually put trpc inside the nextjs project or have it outside as a separate package/service? I've seen some people put the whole trpc in a package of its own and just import the api object in nextjs from the package. wondering what are the advantages and disadvantages of the either way...

Is to possible to update the trpc client url?

Hello, I have create my trpc client this way: ```ts...

websocket or sse

So, im implementing real time transcription using google api , so should i use sockets or sse in trpc for this? im using nextjs btw , also tried integrate sockets in my app , its pretty complex for a noob coder like me...

How to use output validation for dates? (Zod, SuperJSON)

I am trying to add output validation with zod, and my defined zod schema. I have currently set up superJson to transform my objects to and from, so that it can also do date transformation. If I add .output(ZodSchemaObject) it throws Expected date, received string ...

Can someone explain to me how `deserialize` works in `input` of `transformer`?

```TypeScript export interface DataTransformer { serialize(object: any): any; deserialize(object: any): any; }...

WebSocket Subscriptions in Next.js 14 Using `fetchRequestHandler` and `createTRPCReact`

Hello everyone, Does anyone have a working example of using WebSockets/subscriptions with fetchRequestHandler on Next.js 14? I haven't been able to get subscriptions working with my current approach using fetchRequestHandler and createTRPCReact. Any help would be greatly appreciated!...
Solution:
You can use the httpSubscriptionLink, but it won't work well on serverless

How do I pass FormData from client to the public procedure ?

Whilst being able to pass objects when calling mutate() from react-query's, FormData seems to not work. Logging input from public procedure results to empty object ? Any workaround ?...

TRPCClientError: Cannot use 'in' operator to search for 'error' in null

I am getting weird errors only in production. Everything works and builds perfectly fine locally, but I'm not sure why I am getting these errors in production. I am using the https://github.com/clerk/t3-turbo-and-clerk boilerplate.

All backend imports becoming accessible on frontend?

Node Environment Version: v20.10.0 Package Manager: PNPM Workspaces Repo Setup: Monorepo/Turborepo Environment: WSL with VSCode ...

Component suspends/rerenders on cached querykey

I've been trying to fix this issue for ours but dont get ahead I have a query which takes in a string literal value as an input This input is changed by the component prop...
Solution:
Somehow setting the staleTime to non 0 works as a solution

New versions doesn't fit the docs?

I just updated versions of my packages and now I get typescript errors that the my query doesn't fit with the types. It says that I'm missing initialData and queryKey for .useQuery() however docs says that the queryKey should be auto generated. No? My package versions: ``` "@tanstack/react-query": "^5.45.1", "@trpc/react-query": "10.45.2",...

Find Usages of a procedure do not show client calls.

If I define a procedure: ``` const appRouter = router({ list: publicProcedure.query(...)...