T
tRPC

❓-help

createTRPCNext and createTRPCProxyClient within one NextJs app

Sshovancak5/3/2023
Hey, Is there any possibility to use createTRPCNext and createTRPCProxyClient clients in one NextJs app? I have a use-case where I need to use a vanilla client to fetch data in my app but I don't want to lose the possibility of using useQuery and useMutation hooks in my components.
Nnlucas5/3/2023
You can use both, it might be a code smell if there’s a better way but they shouldn’t conflict with each other
Sshovancak5/3/2023
But what about things like caching or query invalidation? Client created by createTRPCProxyClient use tenstack react query it is handled out of the box 🤔. This can be problem in case of vanilla client
Nnlucas5/3/2023
Yep, that’s your trade off
Sshovancak5/3/2023
Thank you 👍
Mmossotron5/10/2023
Im also running into this issue today, would be cool if there was a way you could pass the client created from createTRPCProxyClient into createTRPCNext so you're sharing the instance between them. Or better, a way to access the underlying trpc client created by createTRPCNext

Looking for more? Join the community!

Recommended Posts
Calling axios requests not workingIf i call an API using axios in trpc query procedure It works if the url is https it dont if url is Best practices in naming and defining procedures when they don't fit into standard buckets?I am loving TRPC and its type safety, but I feel like I'm struggling with the naming of procedures. Separating routers into their own modules and merging them causes "any" type in clientHi all, I've separated my router into multiple files, but when merging them I get `any` types for aCan i use try/catch in procedures?can i use try/catch in procedures to pass the error when catching errors in my functions?custom query functionI have a use case where I need a trpc procedure call when a specific key is not present in the localTRPC type checking during build failsEnvironment: node 18.6.0, yarn Whats wrong: Type checking at build time fails. . I think this mightcreateTRPCNext config ctx always returns undefined.Hi Everyone. So I'm trying to use TRPC and Nextjs for auth and post query etc. I have client side cStandalone Next.js 13.3.2 errorHi, since the 13.3.2 update of Next.js, I have the following error : ``` TypeError: Cannot read proDoes tRPC works in application network layer (HTTP) or transport network layer (TCP, UDP)?Just wondering if tRPC uses TCP under the hood.returning undefined from server gets stripped on the clientI encounter this issue when working with TRPC React under a Turborepo. But I works fine on Next I sTypeScript, Mono-Repositories and Internal Packages / Project ReferencesI am getting quite frustrate with project references / internal projects and the resolving of types how to integrate with Redis (ioredis)Any middleware?Help to deploy my TRPC proj from a monorepo (turborepo) at VercelI'm trying to learn monorepo with TRPC, both are new for me and Im kind struggling to deploy it becaTRPC ratelimiting endpointsI am currently having some problems with a race condition in my TRPC nextJS api. Essentially what iexpress-session for tRPCI am using express-session for all my servers to create session authentication. Is there something next-prisma-websockets-starter seeds twice on 'pnpm dx'Hi, i'm using this starter template for my app. The `dx` script from package.json runs both `prisma Can you return from an API endpoint before a sync operation is complete?I'm curious, if I have an endpoint that saves something to a DB and I choose to return from the endpuseInfiniteQueryHey i saw on trpc docs that it is used with prisma, but can i so it with drizzle ? How to past curso