Summary
🎉 Powertools for AWS Lambda (Typescript) - Event Handler Utility is now Generally Available (GA)
We're excited to announce that the Event Handler utility is now production-ready! 🚀
Event Handler provides lightweight routing to reduce boilerplate for API Gateway REST/HTTP API, ALB and Lambda Function URLs.
⭐ Congratulations to @yoshi-taka, @iamgerg, @fidelisojeah, and @benthorner for their first PR merged in the project 🎉
Import path update
With Event Handler moving to GA, the import path has changed from the experimental namespace to a stable one.
// Before
import { Router } from '@aws-lambda-powertools/event-handler/experimental-rest';
// Now
import { Router } from '@aws-lambda-powertools/event-handler/http';Support for HTTP APIs, ALB, and Function URL
Event Handler now supports HTTP APIs (API Gateway v2), Application Load Balancers (ALB) and Lambda Function URL in addition to the existing REST API and support. This means you can use the same routing API across different AWS services, making it easier to build and migrate serverless applications regardless of your chosen architecture.
import { Router } from '@aws-lambda-powertools/event-handler/http';
import type {
ALBEvent,
APIGatewayProxyEvent,
APIGatewayProxyEventV2,
Context,
LambdaFunctionURLEvent,
} from 'aws-lambda';
const app = new Router();
app.get('/hello', () => {
return {
message: 'Hello Event Handler!',
};
});
// Works across different services without any changes
export const restApiHandler = (event: APIGatewayProxyEvent, context: Context) =>
app.resolve(event, context);
export const httpApiHandler = (
event: APIGatewayProxyEventV2,
context: Context
) => app.resolve(event, context);
export const albHandler = (event: ALBEvent, context: Context) =>
app.resolve(event, context);
export const lambdaFunctionUrlHandler = (
event: LambdaFunctionURLEvent,
context: Context
) => app.resolve(event, context);Response Streaming
You can now stream responses directly from your Lambda functions, enabling use cases like serving large files, real-time data feeds, or progressive rendering. You just need to wrap your Router with streamify and you’re good to go.
import {
Router,
streamify,
} from '@aws-lambda-powertools/event-handler/http';
const app = new Router();
app.get('/video-stream', async (reqCtx) => {
reqCtx.res.headers.set('content-type', 'video/mp4');
return createVideoStream();
});
app.get('/hello', () => {
return { message: 'Hello World' };
});
export const handler = streamify(app);Binary Response
Event Handler now also includes first-class support for binary responses, making it straightforward to serve images, PDFs, or any other binary content from your Lambda functions. The utility handles the necessary encoding and content-type headers automatically.
import { createReadStream } from 'node:fs';
import { Router } from '@aws-lambda-powertools/event-handler/http';
import type { Context } from 'aws-lambda';
const app = new Router();
app.get('/logo', async (reqCtx) => {
reqCtx.res.headers.set('Content-Type', 'image/png');
return createReadStream(`${process.env.LAMBDA_TASK_ROOT}/logo.png`);
});
export const handler = async (event: unknown, context: Context) =>
app.resolve(event, context);Changes
- feat(parser): add type for values parsed by DynamoDBStreamRecord (#4793) by @benthorner
- fix(event-handler): moved the response mutation logic to the
composeMiddlewarefunction (#4773) by @sdangol - feat(event-handler): add support for ALB (#4759) by @svozza
- test(maintenance): Expose ResponseStream object to simplify testing in event handler (#4753) by @svozza
- fix(event-handler): handle repeated queryString values (#4755) by @dreamorosi
- test(maintenance): remove unnecessary esbuild banner from e2e tests (#4745) by @svozza
- feat(event-handler): expose response streaming in public API (#4743) by @svozza
- fix(logger): infinite loop on log buffer when item size is max bytes (#4741) by @fidelisojeah
- fix(logger): not passing persistent keys to children (#4740) by @iamgerg
- fix(event-handler): allow event handler response to return array (#4725) by @arnabrahman
- feat(event-handler): add first-class support for binary responses (#4723) by @svozza
- feat(event-handler): Add support for HTTP APIs (API Gateway v2) (#4714) by @svozza
- chore(event-handler): unflag http handler from experimental (#4801) by @svozza
- feat(batch): use async local storage for batch processing (#4700) by @svozza
- feat(logger): use async local storage for logger (#4668) by @svozza
- feat(metrics): use async local storage for metrics (#4663) (#4694) by @svozza
- improv(commons): Make trace ID access more robust (#4693) by @svozza
📜 Documentation updates
- chore(ci): bumped the layer verison from 40 to 41 (#4800) by @sdangol
- docs(event-handler): added documentation for support for HTTP API, ALB and FURL (#4795) by @sdangol
- chore(deps): upgrade InvokeStore to v0.2.1 (#4794) by @svozza
- docs(event-handler): add response streaming docs (#4786) by @svozza
- chore(deps): bump mkdocs-llmstxt from 0.4.0 to 0.5.0 in /docs (#4789) by @dependabot[bot]
- docs(event-handler): update binary response docs (#4783) by @svozza
- docs(event-handler): updated docs for split router, catch all routes and error handler (#4779) by @sdangol
- chore(deps): bump @types/aws-lambda from 8.10.158 to 8.10.159 (#4771) by @dependabot[bot]
- chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#4769) by @dependabot[bot]
- chore(deps-dev): bump the vitest group across 1 directory with 2 updates (#4765) by @dependabot[bot]
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 58 updates (#4761) by @dependabot[bot]
- docs(metrics): Improved documentation for adding dimensions (#4763) by @sdangol
- chore: add Codeac.io as customer reference (#4748) by @dreamorosi
- chore(deps-dev): bump markdownlint-cli2 from 0.18.1 to 0.19.0 (#4742) by @dependabot[bot]
- chore(deps): bump @types/node from 24.10.0 to 24.10.1 (#4738) by @dependabot[bot]
- chore(deps): bump @types/aws-lambda from 8.10.157 to 8.10.158 (#4739) by @dependabot[bot]
- chore(deps): bump mkdocs-material from 9.6.23 to 9.7.0 in /docs (#4733) by @dependabot[bot]
- chore(deps): bump squidfunk/mkdocs-material from
58dee36to980e11fin /docs (#4731) by @dependabot[bot] - chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#4728) by @dependabot[bot]
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 72 updates (#4730) by @dependabot[bot]
- chore(deps): bump esbuild from 0.25.12 to 0.27.0 (#4729) by @dependabot[bot]
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 38 updates (#4727) by @dependabot[bot]
- chore(deps): bump constructs from 10.4.2 to 10.4.3 (#4722) by @dependabot[bot]
- chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#4710) by @dependabot[bot]
- chore(deps): bump mkdocs-material from 9.6.22 to 9.6.23 in /docs (#4704) by @dependabot[bot]
- chore(deps): bump squidfunk/mkdocs-material from
f5c556ato58dee36in /docs (#4705) by @dependabot[bot] - chore(deps): bump the aws-sdk-v3 group across 1 directory with 89 updates (#4706) by @dependabot[bot]
- chore(deps): bump esbuild from 0.25.11 to 0.25.12 (#4707) by @dependabot[bot]
- chore(deps): bump @types/node from 24.9.2 to 24.10.0 (#4709) by @dependabot[bot]
- chore(deps): bump @types/node from 24.9.1 to 24.9.2 (#4699) by @dependabot[bot]
- chore(deps): bump @types/aws-lambda from 8.10.156 to 8.10.157 (#4697) by @dependabot[bot]
- chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#4690) by @dependabot[bot]
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 60 updates (#4688) by @dependabot[bot]
- docs: move the should i use this or Parser to the top of the validation (#4684) by @kawaaaas
- chore(ci): bumped the layer verison from 39 to 40 (#4683) by @svozza
🔧 Maintenance
- chore(deps): bump aws-xray-sdk-core from 3.11.0 to 3.12.0 (#4792) by @dependabot[bot]
- chore(deps): upgrade InvokeStore to v0.2.1 (#4794) by @svozza
- chore(deps): bump mkdocs-llmstxt from 0.4.0 to 0.5.0 in /docs (#4789) by @dependabot[bot]
- chore(deps): bump actions/checkout from 5.0.1 to 6.0.0 (#4788) by @dependabot[bot]
- chore(deps-dev): bump lint-staged from 16.2.6 to 16.2.7 (#4778) by @dependabot[bot]
- chore(deps-dev): bump @redis/client from 5.9.0 to 5.10.0 (#4777) by @dependabot[bot]
- chore(deps-dev): bump the vitest group across 1 directory with 2 updates (#4776) by @dependabot[bot]
- chore(deps): bump actions/setup-go from 6.0.0 to 6.1.0 (#4775) by @dependabot[bot]
- chore(deps): bump @types/aws-lambda from 8.10.158 to 8.10.159 (#4771) by @dependabot[bot]
- chore(deps): bump github/codeql-action from 4.31.3 to 4.31.4 (#4770) by @dependabot[bot]
- test(event-handler): add e2e tests (#4754) by @dreamorosi
- chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#4769) by @dependabot[bot]
- chore(deps): bump actions/checkout from 5.0.0 to 5.0.1 (#4764) by @dependabot[bot]
- chore(deps-dev): bump the vitest group across 1 directory with 2 updates (#4765) by @dependabot[bot]
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 58 updates (#4761) by @dependabot[bot]
- chore(deps): bump arktype from 2.1.26 to 2.1.27 (#4768) by @dependabot[bot]
- chore: drop npx invocation because Husky 9.1.1 runs hooks without it (#4757) by @yoshi-taka
- chore: upgrade vitest & update coverage exceptions (#4747) by @dreamorosi
- chore: add Codeac.io as customer reference (#4748) by @dreamorosi
- chore(deps): bump github/codeql-action from 4.31.2 to 4.31.3 (#4744) by @dependabot[bot]
- chore(deps-dev): bump markdownlint-cli2 from 0.18.1 to 0.19.0 (#4742) by @dependabot[bot]
- chore(deps): bump @types/node from 24.10.0 to 24.10.1 (#4738) by @dependabot[bot]
- chore(deps): bump @types/aws-lambda from 8.10.157 to 8.10.158 (#4739) by @dependabot[bot]
- chore(deps): bump arktype from 2.1.25 to 2.1.26 (#4735) by @dependabot[bot]
- chore(deps-dev): bump @biomejs/biome from 2.3.4 to 2.3.5 (#4734) by @dependabot[bot]
- chore(deps): bump mkdocs-material from 9.6.23 to 9.7.0 in /docs (#4733) by @dependabot[bot]
- chore(deps): bump actions/dependency-review-action from 4.8.1 to 4.8.2 (#4732) by @dependabot[bot]
- chore(deps): bump squidfunk/mkdocs-material from
58dee36to980e11fin /docs (#4731) by @dependabot[bot] - chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#4728) by @dependabot[bot]
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 72 updates (#4730) by @dependabot[bot]
- chore(deps): bump esbuild from 0.25.12 to 0.27.0 (#4729) by @dependabot[bot]
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 38 updates (#4727) by @dependabot[bot]
- chore(deps): bump constructs from 10.4.2 to 10.4.3 (#4722) by @dependabot[bot]
- chore(deps-dev): bump @biomejs/biome from 2.3.3 to 2.3.4 (#4717) by @dependabot[bot]
- chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#4710) by @dependabot[bot]
- chore(deps): bump mkdocs-material from 9.6.22 to 9.6.23 in /docs (#4704) by @dependabot[bot]
- chore(deps): bump squidfunk/mkdocs-material from
f5c556ato58dee36in /docs (#4705) by @dependabot[bot] - chore(deps): bump the aws-sdk-v3 group across 1 directory with 89 updates (#4706) by @dependabot[bot]
- chore(deps): bump esbuild from 0.25.11 to 0.25.12 (#4707) by @dependabot[bot]
- chore(deps-dev): bump @biomejs/biome from 2.3.2 to 2.3.3 (#4708) by @dependabot[bot]
- chore(deps): bump @types/node from 24.9.2 to 24.10.0 (#4709) by @dependabot[bot]
- chore(deps): bump github/codeql-action from 4.31.1 to 4.31.2 (#4703) by @dependabot[bot]
- chore(deps-dev): bump @valkey/valkey-glide from 2.1.1 to 2.1.2 (#4702) by @dependabot[bot]
- chore(deps): bump github/codeql-action from 4.31.0 to 4.31.1 (#4701) by @dependabot[bot]
- chore(deps): bump @types/node from 24.9.1 to 24.9.2 (#4699) by @dependabot[bot]
- chore(deps-dev): bump @biomejs/biome from 2.3.1 to 2.3.2 (#4698) by @dependabot[bot]
- chore(deps): bump @types/aws-lambda from 8.10.156 to 8.10.157 (#4697) by @dependabot[bot]
- chore(deps): bump arktype from 2.1.24 to 2.1.25 (#4696) by @dependabot[bot]
- chore(deps): bump arktype from 2.1.23 to 2.1.24 (#4692) by @dependabot[bot]
- chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#4690) by @dependabot[bot]
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 60 updates (#4688) by @dependabot[bot]
- chore(deps): bump actions/upload-artifact from 4.6.2 to 5.0.0 (#4691) by @dependabot[bot]
- chore(deps-dev): bump @redis/client from 5.8.3 to 5.9.0 (#4689) by @dependabot[bot]
- chore(deps-dev): bump @biomejs/biome from 2.2.7 to 2.3.1 (#4687) by @dependabot[bot]
- chore(deps): bump actions/download-artifact from 5.0.0 to 6.0.0 (#4686) by @dependabot[bot]
- chore(deps): bump github/codeql-action from 4.30.9 to 4.31.0 (#4685) by @dependabot[bot]
- chore(deps-dev): bump @biomejs/biome from 2.2.6 to 2.2.7 (#4675) by @dependabot[bot]
This release was made possible by the following contributors:
@arnabrahman, @benthorner, @dependabot[bot], @dreamorosi, @fidelisojeah, @github-actions[bot], @iamgerg, @kawaaaas, @sdangol, @svozza, @yoshi-taka, dependabot[bot] and github-actions[bot]