What problem does it solve?
This Skill documents how to run tRPC routers and procedures within AWS Lambda environments, handling differences between API Gateway v1 (REST), API Gateway v2 (HTTP), and Lambda Function URLs while enabling response streaming and proper context creation.
Core Features & Use Cases
- API Gateway compatibility: Examples for using APIGatewayProxyEvent (v1) and APIGatewayProxyEventV2 (v2) payload types with awsLambdaRequestHandler.
- Streaming support: Guidance for enabling response streaming using awsLambdaStreamingRequestHandler wrapped with awslambda.streamifyResponse for Lambda Function URLs and REST APIs.
- Batching and limits: Advice on maxBatchSize configuration and client coordination to avoid request rejections, plus a common-mistakes section for routing and batching pitfalls.
- Use Case: Expose a tRPC backend from a Next.js or Node.js service to serve SPA clients via API Gateway or Lambda Function URLs, including streaming procedures like progress updates or server-sent events.
Quick Start
Expose your tRPC router by creating an AWS Lambda handler using awsLambdaRequestHandler or awsLambdaStreamingRequestHandler wrapped with awslambda.streamifyResponse and a createContext implementation.