t
tRPC
S
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
?
tRPC
Join
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Recent Announcements
Similar Threads
trpc + AWS Lambda (through cdk)
F
ferdy / ❓-help
3y ago
Lambda WITHOUT API Gateway (Lambda Function URL)
H
Han Moos / ❓-help
3y ago
Setting up tRPC with Supabase and Drizzle
W
Wezter / ❓-help
3y ago