AWS Lambda
The Lambda adapter accepts API Gateway HTTP API payload v2.0, API Gateway REST API payload v1.0, and Lambda Function URLs without configuration. It handles base64 bodies, v2 cookies, v1 multiValueHeaders, and forwards method, path, query, and headers into a standard Request.
- triggerHTTP API v2 · REST v1 · Function URLLambda event payload
- adaptertoLambdaHandler(app)decodes base64, cookies, multiValueHeaders
- coreapp.fetch(Request)routing · hooks · handler
- triggerLambda resultor streamed via toLambdaStreamHandler
When to choose Lambda
- You already run on AWS and want IAM-integrated invocation.
- You want per-request billing without managing a server.
- You need long timeouts (up to 15 minutes) or larger memory than edge functions allow.
Install
The adapter ships with @daloyjs/core. For deployment, use AWS SAM, CDK, the Serverless Framework, or any IaC of your choice.
Function URL or API Gateway HTTP API
Streaming responses
Lambda supports response streaming via awslambda.streamifyResponse. Use the streaming variant of the adapter when you need to flush headers and bytes incrementally (Server-Sent Events, large downloads).
SAM template
DaloyJS requires Node 24 LTS or Node 26+ (engines.node: "^24.0.0 || >=26.0.0"). Use the nodejs24.x managed runtime where available, or ship a container image (see Lambda Web Adapter below) if your region's runtime catalog is older.
Lambda Web Adapter (container deployments)
If you prefer to ship a container image and keep the Node adapter, the AWS Lambda Web Adapter translates Lambda invocations to plain HTTP. Useful when you want one image for both ECS and Lambda.
Gotchas
- Callback-style handlers (
(event, context, callback) => ...) are not supported on supported Node versions. Always useasynchandlers. The DaloyJS adapter does. - For Function URLs with streaming, set
InvokeMode: RESPONSE_STREAMand usetoLambdaStreamHandler. - Cold starts: prefer the Node adapter on provisioned concurrency or use a container with the Web Adapter for warmer reuse.
- Since 1.3.7 the adapter answers
400when the event'sHostheader is not a plainhost[:port]or bracketed IPv6 literal (for example one containing\ / ? # @ %or whitespace). The host is spliced into the request URL, so such a value could otherwise move bytes into the path thatexcept()and other middleware match on. X-Forwarded-Protois honoured only when the App declares a proxy (behindProxyset and not"none"), and then only ashttporhttps, read from the last comma-separated entry (the one the nearest proxy appended). Otherwise the scheme ishttps, so a client-sent header can't downgrade the URL your app sees (since 1.5.4; before that, the first entry was honoured without a declared proxy).
See also
- Adapters overview
- Netlify Functions: v1 still uses the same Lambda event shape if you need it.
- Streaming (SSE & NDJSON)