tRPCttRPC
Powered by
sydvikingS
tRPC•3y ago
sydviking

Setting up trpc behind AWS API gateway and authorizing using a lambda

Current setup:
- trpc api, containing both public an private procedures. Let's call them
posts.list
posts.list
(public)
posts.create
posts.create
(private)

- API gateway routes
GET /trpc/{proxy+}
GET /trpc/{proxy+}
and
POST /trpc/{proxy+}
POST /trpc/{proxy+}
that invoke a lambda handler for trpc (let's call it
trpc.handler
trpc.handler
)

- Auth is handled inside of
trpc.handler
trpc.handler
using a middleware that checks the token etc.

Setup I want:

- Extract the auth part into a different lambda (let's call it
auth.handler
auth.handler
)
- Only run this authorizer for the private routes.

As I don't know in advance what the request url might look like (e.g. it could be batched), is this possible to setup?
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

trpc + AWS Lambda (through cdk)
ferdyFferdy / ❓-help
3y ago
Lambda WITHOUT API Gateway (Lambda Function URL)
Han MoosHHan Moos / ❓-help
3y ago
Setting up tRPC with Supabase and Drizzle
WezterWWezter / ❓-help
3y ago