T
tRPC

โ“-help

Proxy TRPC server to another client

IItsWendell11/27/2022
I've two TRPC servers, one essentially acts like a proxy, it validates auth and based on a specific property it forwards you to the destined server (with that one property removed). Now I have to write all those queries and mutation twice, is there a simpeler way to do this? Is there any way to bind a specific TRPC client to a server? A little bit more context, the other server is a Cloudflare Workers Durable Object, which I managed to get to work with TRPC. I can essentially do: const trpc = MyDurableObject.getClient(id) which will return a TRPC client instance.
AKAlex / KATT ๐Ÿฑ11/27/2022
Unsure if it helps but here is an example how you can glue services in the client https://github.com/trpc/trpc/tree/main/examples/soa
GitHub
trpc/examples/soa at main ยท trpc/trpc
๐Ÿง™โ€โ™€๏ธ Move Fast and Break Nothing. End-to-end typesafe APIs made easy. - trpc/examples/soa at main ยท trpc/trpc
IItsWendell11/27/2022
Hmh no I want to glue a specific client to a server, not a client to two servers or two routers into 1 server, I want a trpc router to act like a proxy. Since Durable Objects are not accessable outside of Workers, both of which can be viewed as servers. E.g. server A can only access server B, but I want the client to be able to access server B through server A.
AKAlex / KATT ๐Ÿฑ11/27/2022
We don't have anything automatic for that but wouldn't be impossible to build Sounds like graphql federation but for trpc haha
IItsWendell11/27/2022
Yeah that would be awesome to have, especially in the serverless context

Looking for more? Join the community!

T
tRPC

โ“-help

Join Server
Recommended Posts
Unexpected tokenhi, kindly help me on this oneThrow custom TRPCError with specific causeHello everyone ! I'm trying to throw a custom TRPCError with a specific cause that i can differentiaDelay IsLoading....i'm trying to delay a loading spinner from appearing if the api takes less than 200ms to get the datClearing CacheHow do I clear the queryCache for a particular query using the trpc context? If that's not possible,context at times emptyam new to trpc. i am usin iron-session with nextjs and its awesome. am forwarding the context. but sTRPC Testing Wrapper - Unit Testing components that contain a query (Not testing the query it self)This is my wrapper reference from trpc: https://github.com/WeirdoGit/NewGitRepo/blob/162cd9317c0e978query and mutate promise on nextI've followed the guide "Usage with Next.js" and now I only have the `useQuery` and use `useMutationtesting a trpc hooki'm brand new to testing and need some help with writing a test for a hook that is returning an objeCAS AuthenticationSo long story short. My University is using CAS as authentication provider. I was thinking that I coDifference in type inference for vanilla client?Hello, querying an endpoint with the vanilla tRPC client but at runtime the actual result isn't the Zod Error MiddlewareHey lovely people. At Cal.com we make heavy use of `zod` for data validation. I was wondering if theclear cookie onErrorI'd like to clear a cookie (in nextjs) when a 403 error happens. I've been looking at the global errRequest context from getServerSidePropsThe docs of tRPC context https://trpc.io/docs/v10/context ``` export async function createContext(oAuth with passport.jsEvening all, Has anyone successfully setup trpc with passport.js for auth?Object keeps getting overwrittenI feel like i'm missing something fundamental here. when I add a new entry into object ``b`` it resAccessToken for API callsWhat would be the best approach to pass the AccessToken from NextAuth Session to the Http Client whi