T
Join ServertRPC
❓-help
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
- API gateway routes
- Auth is handled inside of
Setup I want:
- Extract the auth part into a different lambda (let's call it
- 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?
- trpc api, containing both public an private procedures. Let's call them
posts.list
(public) posts.create
(private)- API gateway routes
GET /trpc/{proxy+}
and POST /trpc/{proxy+}
that invoke a lambda handler for trpc (let's call it trpc.handler
)- Auth is handled inside of
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
)- 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?