Lambdas and Edge functions in same tRPC Project?
How do you create a trpc app that uses both Lambdas and Edge functions (NextJS specifically)? Do you need to create two separate routers? Been struggling to find the right way to do this.
8 Replies
from what i understand this currently isn't possible without splitting the router. would be a great thing to bring up on the trpc discord or github issues/discussions
Yeah splitting the router is what I did. Not the worst thing in the world to do. Thanks for the answer 🙂
Did you add TRPc to both Edge and Lambda? Just curious
Yeah i have two routers with two different urls. I use a splitLink to determine which url to pick. New to T3 so there prob is a better way to do this but this works.
thats a pretty good implementation
iirc julius did a lot of router splitting in the cal.com codebase, maybe take a look there if you want some more inspiration
ooh ty 🙂
Also curious: Do you use kysely, or drizzle?
Drizzle sorry for the late reply