Download Latest Version v2.30.0 source code.tar.gz (2.5 MB)
Email in envelope

Get an email when there's a new version of AWS Powertools for Lambda

Home / v2.28.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2025-10-21 16.9 kB
v2.28.0 source code.tar.gz 2025-10-21 2.5 MB
v2.28.0 source code.zip 2025-10-21 3.2 MB
Totals: 3 Items   5.7 MB 0

Summary

We are excited to announce that the REST API Event Handler now supports catch-all routes, allowing you to use regex patterns directly when defining route paths. We've also added the ability to split routers using includeRouter for both REST API and AppSync GraphQL Event Handlers.

We’ve also reverted the SQSRecordSchema change that caused failed parsing of records when md5OfMessageAttributes was null.

📜 Announcement: You can now find our documentation on the official AWS documentation domain at https://docs.aws.amazon.com/powertools/typescript/latest/

⭐ Congratulations @mdesousa, @thiagomeireless, @alex-karo for their first PR merged in the project 🎉

Catch-all route

You can now use regex patterns in your routes to handle arbitrary or deeply nested paths.

:::typescript
import { Router } from '@aws-lambda-powertools/event-handler/experimental-rest';

const app = new Router();

// Instead of defining every possible path
app.get('/files/:folder/:subfolder/:filename');

// Use regex to handle any depth
app.get(/\/files\/.*/, async (reqCtx) => {
  // This will match:
  // /files/docs/2025/report.pdf
  // /files/images/avatars/user1/profile.jpg
  // /files/any/number/of/nested/paths/file.txt
});

We recommend having explicit routes whenever possible. Catch-all routes should be used sparingly and the pattern should be documented.

Split Routers

You can now define routes in separate files and import them into a main router file, improving code organization and maintainability.

REST API Event Handler

:::typescript
// userRoutes.ts
import { Router } from '@aws-lambda-powertools/event-handler/experimental-rest';

const userRouter = new Router();
userRouter.get('/', listUsers);
userRouter.post('/', createUser)
userRouter.get('/:id', getUser)

export { userRouter };

:::typescript
// orderRoutes.ts
import { Router } from '@aws-lambda-powertools/event-handler/experimental-rest';

const orderRouter = new Router();
orderRouter.get('/orders', listOrders);
orderRouter.post('/orders', createOrder);
orderRouter.put('/orders/:id/status', updateStatus);

export { orderRouter };

:::typescript
// main.ts
import { Router } from '@aws-lambda-powertools/event-handler/experimental-rest';
import type { APIGatewayProxyEvent } from 'aws-lambda';
import type { Context } from 'aws-lambda';
import { userRouter } from './userRoutes.js';
import { orderRouter } from './orderRoutes.js';

const app = new Router();

// Split Routers
app.includeRouter(userRouter, { prefix: '/users' });
app.includeRouter(orderRouter, { prefix: '/orders' });

export const handler = async (event: APIGatewayProxyEvent, context: Context) =>
  app.resolve(event, context);

AppSync GraphQL Event Handler

:::typescript
// postRouter.ts
import { Router } from '@aws-lambda-powertools/event-handler/appsync-graphql';

const postRouter = new Router();

postRouter.onQuery('getPosts', getPosts);
postRouter.onMutation('createPost', createPost);

export { postRouter };

:::typescript
//userRouter.ts
import { Router } from '@aws-lambda-powertools/event-handler/appsync-graphql';

const userRouter = new Router();

userRouter.onQuery('getUsers', getUsers);

export { userRouter };

:::typescript
// main.ts
import { AppSyncGraphQLResolver } from '@aws-lambda-powertools/event-handler/appsync-graphql';
import type { Context } from 'aws-lambda';
import { postRouter } from './postRouter';
import { userRouter } from './userRouter';

const app = new AppSyncGraphQLResolver();

app.includeRouter([postRouter, userRouter]);

export const handler = async (event: unknown, context: Context) =>
  app.resolve(event, context);

Changes

  • improv(event-handler): ended response stream when body is null (#4651) by @sdangol
  • fix(idempotency): add null check for idempotencyHandler before calling handleMiddyOnError (#4643) by @mdesousa
  • fix(parser): updated the SQSRecordSchema to make the md5OfMessageAttributes nullable (#4632) by @sdangol
  • fix(event-handler): allow http handlers to return duplex streams (#4629) by @svozza
  • fix(logger): correct persistentLogAttributes warning behavior (#4627) by @alex-karo
  • feat(event-handler): added support for catch all route (#4582) by @sdangol
  • improv(event-handler): rename ServiceError class to HttpError (#4610) by @svozza
  • docs(parser): correct typos in example code for middleware (#4607) by @thiagomeireless
  • test: update domain in e2e tests (#4606) by @dreamorosi
  • ci: add --delete flag to docs publish command (#4584) by @dreamorosi
  • feat(event-handler): added includeRouter method to split routes (#4573) by @sdangol
  • chore: sanitize CI inputs via env var (#4528) by @dreamorosi
  • feat(event-handler): Add includeRouter support to AppSync GraphQL resolver (#4457) by @arnabrahman

📜 Documentation updates

  • chore(ci): bumped the layer verison from 38 to 39 (#4671) by @sdangol
  • chore(deps): bump aws-cdk-lib from 2.219.0 to 2.220.0 in the aws-cdk group across 1 directory (#4665) by @dependabot[bot]
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 88 updates (#4664) by @dependabot[bot]
  • chore(deps): bump @types/node from 24.8.0 to 24.8.1 (#4661) by @dependabot[bot]
  • chore(deps): bump @types/node from 24.7.2 to 24.8.0 (#4654) by @dependabot[bot]
  • chore(deps): bump @types/aws-lambda from 8.10.155 to 8.10.156 (#4653) by @dependabot[bot]
  • chore(deps): bump esbuild from 0.25.10 to 0.25.11 (#4648) by @dependabot[bot]
  • chore(deps): bump mkdocs-material from 9.6.21 to 9.6.22 in /docs (#4647) by @dependabot[bot]
  • chore(deps): bump squidfunk/mkdocs-material from 00f9276 to f5c556a in /docs (#4646) by @dependabot[bot]
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 49 updates (#4637) by @dependabot[bot]
  • chore(deps): bump @types/node from 24.7.1 to 24.7.2 (#4642) by @dependabot[bot]
  • chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#4638) by @dependabot[bot]
  • chore(deps): bump @types/node from 24.7.0 to 24.7.1 (#4628) by @dependabot[bot]
  • chore(deps): bump @types/aws-lambda from 8.10.153 to 8.10.155 (#4617) by @dependabot[bot]
  • chore: add AWS bootstrap js + update urls (#4614) by @dreamorosi
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 99 updates (#4619) by @dependabot[bot]
  • chore(deps): bump mkdocs-llmstxt from 0.3.2 to 0.4.0 in /docs (#4615) by @dependabot[bot]
  • chore(deps): bump @types/node from 24.6.2 to 24.7.0 (#4618) by @dependabot[bot]
  • chore(deps): bump @types/node from 24.6.1 to 24.6.2 (#4613) by @dependabot[bot]
  • chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#4589) by @dependabot[bot]
  • chore(deps): bump typescript from 5.9.2 to 5.9.3 in the typescript group across 1 directory (#4599) by @dependabot[bot]
  • chore(deps): bump squidfunk/mkdocs-material from 86d21da to 00f9276 in /docs (#4598) by @dependabot[bot]
  • chore(deps): bump @types/aws-lambda from 8.10.152 to 8.10.153 (#4600) by @dependabot[bot]
  • chore(deps): bump mkdocs-material from 9.6.20 to 9.6.21 in /docs (#4596) by @dependabot[bot]
  • chore(deps): bump @types/node from 24.6.0 to 24.6.1 (#4601) by @dependabot[bot]
  • chore(deps): bump @types/node from 24.5.2 to 24.6.0 (#4595) by @dependabot[bot]
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 45 updates (#4592) by @dependabot[bot]
  • docs: update install command for parser (#4585) by @dreamorosi
  • chore(deps): bump tsx from 4.20.5 to 4.20.6 (#4580) by @dependabot[bot]
  • ci: improve linting checks (#4545) by @dreamorosi
  • chore(ci): update layer ARN on documentation (#4535) by @sdangol

🔧 Maintenance

  • chore(deps-dev): bump lint-staged from 16.2.4 to 16.2.5 (#4672) by @dependabot[bot]
  • chore(deps): bump aws-cdk-lib from 2.219.0 to 2.220.0 in the aws-cdk group across 1 directory (#4665) by @dependabot[bot]
  • chore(deps): bump github/codeql-action from 4.30.8 to 4.30.9 (#4666) by @dependabot[bot]
  • feat(metrics): use async local storage for metrics (#4663) by @svozza
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 88 updates (#4664) by @dependabot[bot]
  • chore(deps): bump @types/node from 24.8.0 to 24.8.1 (#4661) by @dependabot[bot]
  • chore: update CONTRIBUTING.md (#4659) by @ConnorKirk
  • improv(commons): Make X-Ray trace ID access more robust (#4658) by @svozza
  • chore(deps): bump @types/node from 24.7.2 to 24.8.0 (#4654) by @dependabot[bot]
  • chore(deps): bump aws-xray-sdk-core from 3.10.3 to 3.11.0 (#4656) by @dependabot[bot]
  • chore(deps-dev): bump avro-js from 1.12.0 to 1.12.1 (#4655) by @dependabot[bot]
  • chore(deps): bump @types/aws-lambda from 8.10.155 to 8.10.156 (#4653) by @dependabot[bot]
  • chore(deps): bump vscode/devcontainers/javascript-node from 9b4b7e4 to fd373e0 in /.devcontainer (#4652) by @dependabot[bot]
  • chore(deps): bump esbuild from 0.25.10 to 0.25.11 (#4648) by @dependabot[bot]
  • chore(deps): bump mkdocs-material from 9.6.21 to 9.6.22 in /docs (#4647) by @dependabot[bot]
  • chore(deps): bump squidfunk/mkdocs-material from 00f9276 to f5c556a in /docs (#4646) by @dependabot[bot]
  • chore(deps): bump actions/setup-node from 5.0.0 to 6.0.0 (#4644) by @dependabot[bot]
  • chore(deps): bump arktype from 2.1.22 to 2.1.23 (#4645) by @dependabot[bot]
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 49 updates (#4637) by @dependabot[bot]
  • chore(deps): bump @types/node from 24.7.1 to 24.7.2 (#4642) by @dependabot[bot]
  • chore(deps-dev): bump the typescript group across 1 directory with 2 updates (#4641) by @dependabot[bot]
  • chore(deps-dev): bump lint-staged from 16.2.3 to 16.2.4 (#4640) by @dependabot[bot]
  • chore(deps): bump github/codeql-action from 4.30.7 to 4.30.8 (#4639) by @dependabot[bot]
  • chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#4638) by @dependabot[bot]
  • chore(deps-dev): bump @biomejs/biome from 2.2.5 to 2.2.6 (#4636) by @dependabot[bot]
  • chore(deps): bump actions/dependency-review-action from 4.8.0 to 4.8.1 (#4635) by @dependabot[bot]
  • chore(deps): bump github/codeql-action from 3.30.6 to 4.30.7 (#4623) by @dependabot[bot]
  • chore(deps): bump @types/node from 24.7.0 to 24.7.1 (#4628) by @dependabot[bot]
  • chore(deps): bump @valkey/valkey-glide from 2.1.0 to 2.1.1 (#4625) by @dependabot[bot]
  • chore(deps): bump aws-actions/configure-aws-credentials from 5.0.0 to 5.1.0 (#4620) by @dependabot[bot]
  • chore(deps): bump @types/aws-lambda from 8.10.153 to 8.10.155 (#4617) by @dependabot[bot]
  • chore(deps-dev): bump zod from 4.1.11 to 4.1.12 (#4621) by @dependabot[bot]
  • chore: add AWS bootstrap js + update urls (#4614) by @dreamorosi
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 99 updates (#4619) by @dependabot[bot]
  • chore(deps): bump mkdocs-llmstxt from 0.3.2 to 0.4.0 in /docs (#4615) by @dependabot[bot]
  • chore(deps): bump actions/stale from 10.0.0 to 10.1.0 (#4616) by @dependabot[bot]
  • chore(deps): bump @types/node from 24.6.2 to 24.7.0 (#4618) by @dependabot[bot]
  • chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.25 to 4.0.0 (#4587) by @dependabot[bot]
  • chore(deps): bump github/codeql-action from 3.30.5 to 3.30.6 (#4612) by @dependabot[bot]
  • chore(deps): bump @types/node from 24.6.1 to 24.6.2 (#4613) by @dependabot[bot]
  • chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#4589) by @dependabot[bot]
  • chore(deps): bump typescript from 5.9.2 to 5.9.3 in the typescript group across 1 directory (#4599) by @dependabot[bot]
  • chore(deps): bump squidfunk/mkdocs-material from 86d21da to 00f9276 in /docs (#4598) by @dependabot[bot]
  • chore(deps): bump @types/aws-lambda from 8.10.152 to 8.10.153 (#4600) by @dependabot[bot]
  • chore(deps): bump mkdocs-material from 9.6.20 to 9.6.21 in /docs (#4596) by @dependabot[bot]
  • chore(deps): bump @types/node from 24.6.0 to 24.6.1 (#4601) by @dependabot[bot]
  • chore(deps-dev): bump @redis/client from 5.8.2 to 5.8.3 (#4603) by @dependabot[bot]
  • chore(deps-dev): bump @biomejs/biome from 2.2.4 to 2.2.5 (#4604) by @dependabot[bot]
  • chore(deps): bump ossf/scorecard-action from 2.4.2 to 2.4.3 (#4597) by @dependabot[bot]
  • feat(event-handler): add streaming functionality (#4586) by @svozza
  • chore(deps): bump actions/dependency-review-action from 4.7.3 to 4.8.0 (#4591) by @dependabot[bot]
  • chore(deps): bump @types/node from 24.5.2 to 24.6.0 (#4595) by @dependabot[bot]
  • chore(deps): bump github/codeql-action from 3.30.4 to 3.30.5 (#4588) by @dependabot[bot]
  • chore(deps-dev): bump lint-staged from 16.2.1 to 16.2.3 (#4590) by @dependabot[bot]
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 45 updates (#4592) by @dependabot[bot]
  • chore(deps-dev): bump lint-staged from 16.2.0 to 16.2.1 (#4581) by @dependabot[bot]
  • chore(deps): bump tsx from 4.20.5 to 4.20.6 (#4580) by @dependabot[bot]
  • ci: improve linting checks (#4545) by @dreamorosi
  • chore(deps): bump github/codeql-action from 3.30.3 to 3.30.4 (#4576) by @dependabot[bot]

This release was made possible by the following contributors:

@ConnorKirk, @alex-karo, @arnabrahman, @dependabot[bot], @dreamorosi, @github-actions[bot], @mdesousa, @sdangol, @svozza, @thiagomeireless, dependabot[bot] and github-actions[bot]

Source: README.md, updated 2025-10-21