Download Latest Version v2.33.0 source code.tar.gz (2.6 MB)
Email in envelope

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

Home / v2.31.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2026-02-10 11.1 kB
v2.31.0 source code.tar.gz 2026-02-10 2.5 MB
v2.31.0 source code.zip 2026-02-10 3.2 MB
Totals: 3 Items   5.8 MB 1

Summary

In this release we are pleased to announce Tracer middleware for the HTTP event handler, which allows users to enable distributed tracing for their HTTP routes with minimal boilerplate code.

In addition, the metric utility now supports a fluent interface, allowing you to chain multiple methods in a single statement.

We have also fixed a bug in the HTTP event handler that caused parameterized headers to be handled incorrectly.

⭐ Special thanks to @nateiler and @dothomson for their first PR merged in the project, and to @arnabrahman! for another great contribution 🎉

Tracer Middleware

You can now use the Tracer utility with the HTTP event handler to gain observability over your routes. The middleware:

  • Creates a subsegment for each HTTP route with the format METHOD /path (e.g., GET /users)
  • Adds ColdStart and Service annotations
  • Optionally captures JSON response bodies as metadata
  • Captures errors as metadata when exceptions occur

    :::ts import { Router } from '@aws-lambda-powertools/event-handler/http'; import { tracer as tracerMiddleware } from '@aws-lambda-powertools/event-handler/http/middleware/tracer'; import { Tracer } from '@aws-lambda-powertools/tracer'; import type { Context } from 'aws-lambda';

    const tracer = new Tracer({ serviceName: 'my-api' }); const app = new Router();

    app.get( '/users/cards', [tracerMiddleware(tracer, { captureResponse: false })], ({ params }) => { return { id: params.id, secret: 'sensitive-data' }; } );

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

Metrics Fluent Interface

All mutation methods (with the exception of clear*) now return the metric instance that was mutated, allowing you to chain multiple metrics operations in a single statement.

:::ts
import { Metrics} from '@aws-lambda-powertools/metrics';

const metrics = new Metrics();

metrics
    .addDimension('environment', 'prod')
    .addDimension('commit', '1234')
    .addMetric('test1', MetricUnit.Count, 1);
    .addMetric('test2', MetricUnit.Count, 1);

Changes

  • ci: use ts extension in layer CDK stack imports (#5010) by @svozza
  • ci: fix layer import in CDK stack (#5009) by @dreamorosi
  • fix(event-handler): handle set-cookie header values with multiple attributes (#4990) by @nateiler
  • chore: manually upgrade dependency tree (#5002) by @dreamorosi
  • ci: switch npm auth to OIDC (#4997) by @dreamorosi
  • fix(kafka): handle tombstone events (#4991) by @dreamorosi
  • test: extract DF idempotency e2e tests (#4994) by @dreamorosi
  • ci: remove workflow-based PR automation (#4996) by @dreamorosi
  • chore(ci): update layer script to include event-handler (#4956) by @svozza
  • feat(metrics): return metrics instance from metrics functions (#4930) by @dothomson
  • feat(parameters): pass underlying SDK error as cause to GetParameterError (#4936) by @felsidian

📜 Documentation updates

  • chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#4985) by @dependabot[bot]
  • feat(event-handler): add tracer middleware for HTTP routes (#4982) by @arnabrahman
  • chore(deps): bump @types/node from 25.1.0 to 25.2.0 (#4983) by @dependabot[bot]
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 49 updates (#4984) by @dependabot[bot]
  • chore(deps): bump @types/node from 25.0.10 to 25.1.0 (#4980) by @dependabot[bot]
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 43 updates (#4975) by @dependabot[bot]
  • chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#4976) by @dependabot[bot]
  • chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#4959) by @dependabot[bot]
  • chore(deps): bump @types/node from 25.0.9 to 25.0.10 (#4968) by @dependabot[bot]
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 93 updates (#4958) by @dependabot[bot]
  • chore(deps): bump @types/aws-lambda from 8.10.159 to 8.10.160 (#4963) by @dependabot[bot]
  • chore(deps): bump constructs from 10.4.4 to 10.4.5 (#4957) by @dependabot[bot]
  • chore(deps): bump @types/node from 25.0.8 to 25.0.9 (#4954) by @dependabot[bot]
  • docs(event-handler): add http router decorator examples (#4950) by @matthew2564
  • chore(deps): bump @types/node from 25.0.6 to 25.0.8 (#4952) by @dependabot[bot]
  • chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#4947) by @dependabot[bot]
  • chore(deps): bump @types/node from 25.0.3 to 25.0.6 (#4945) by @dependabot[bot]
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 62 updates (#4946) by @dependabot[bot]
  • improv(docs): fixed the extra dependencies table (#4940) by @sdangol

🔧 Maintenance

  • chore(deps-dev): bump @valkey/valkey-glide from 2.2.6 to 2.2.7 (#5006) by @dependabot[bot]
  • chore(deps): bump @types/node from 25.2.0 to 25.2.2 (#5004) by @dependabot[bot]
  • chore(deps): bump github/codeql-action from 4.32.1 to 4.32.2 (#4998) by @dependabot[bot]
  • chore(deps): bump @types/node from 25.2.0 to 25.2.1 (#4999) by @dependabot[bot]
  • chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#4985) by @dependabot[bot]
  • chore(deps): bump github/codeql-action from 4.32.0 to 4.32.1 (#4987) by @dependabot[bot]
  • chore(deps): bump aws-actions/configure-aws-credentials from 5.1.1 to 6.0.0 (#4992) by @dependabot[bot]
  • chore(deps-dev): bump @biomejs/biome from 2.3.13 to 2.3.14 (#4989) by @dependabot[bot]
  • feat(event-handler): add tracer middleware for HTTP routes (#4982) by @arnabrahman
  • chore(deps): bump @types/node from 25.1.0 to 25.2.0 (#4983) by @dependabot[bot]
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 49 updates (#4984) by @dependabot[bot]
  • test: add e2e tests for batch processing (#4978) by @dreamorosi
  • test(idempotency): add Durable function e2e test case (#4979) by @dreamorosi
  • chore(deps): bump @types/node from 25.0.10 to 25.1.0 (#4980) by @dependabot[bot]
  • chore(deps-dev): bump @biomejs/biome from 2.3.11 to 2.3.13 (#4974) by @dependabot[bot]
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 43 updates (#4975) by @dependabot[bot]
  • chore(deps): bump github/codeql-action from 4.31.10 to 4.32.0 (#4977) by @dependabot[bot]
  • chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#4976) by @dependabot[bot]
  • chore(deps-dev): bump the vitest group across 1 directory with 2 updates (#4970) by @dependabot[bot]
  • chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#4959) by @dependabot[bot]
  • chore(deps): bump @types/node from 25.0.9 to 25.0.10 (#4968) by @dependabot[bot]
  • chore(deps): bump actions/setup-python from 6.1.0 to 6.2.0 (#4967) by @dependabot[bot]
  • chore(deps): bump release-drafter/release-drafter from 6.1.1 to 6.2.0 (#4966) by @dependabot[bot]
  • chore(deps): bump actions/checkout from 6.0.1 to 6.0.2 (#4969) by @dependabot[bot]
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 93 updates (#4958) by @dependabot[bot]
  • chore(deps-dev): bump zod from 4.3.5 to 4.3.6 (#4971) by @dependabot[bot]
  • chore(deps): bump @types/aws-lambda from 8.10.159 to 8.10.160 (#4963) by @dependabot[bot]
  • chore(deps-dev): bump @valkey/valkey-glide from 2.2.5 to 2.2.6 (#4962) by @dependabot[bot]
  • chore(deps): bump release-drafter/release-drafter from 6.1.0 to 6.1.1 (#4961) by @dependabot[bot]
  • chore(deps): bump constructs from 10.4.4 to 10.4.5 (#4957) by @dependabot[bot]
  • chore(deps): bump @types/node from 25.0.8 to 25.0.9 (#4954) by @dependabot[bot]
  • chore(deps): bump actions/setup-node from 6.1.0 to 6.2.0 (#4953) by @dependabot[bot]
  • chore(deps): bump actions/setup-go from 6.1.0 to 6.2.0 (#4948) by @dependabot[bot]
  • chore(deps): bump @types/node from 25.0.6 to 25.0.8 (#4952) by @dependabot[bot]
  • chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#4947) by @dependabot[bot]
  • chore(deps-dev): bump @valkey/valkey-glide from 2.2.1 to 2.2.5 (#4944) by @dependabot[bot]
  • chore(deps-dev): bump the vitest group across 1 directory with 2 updates (#4943) by @dependabot[bot]
  • chore(deps): bump @types/node from 25.0.3 to 25.0.6 (#4945) by @dependabot[bot]
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 62 updates (#4946) by @dependabot[bot]
  • chore(deps-dev): bump typedoc from 0.28.15 to 0.28.16 in the typescript group across 1 directory (#4942) by @dependabot[bot]
  • chore(deps): bump github/codeql-action from 4.31.9 to 4.31.10 (#4941) by @dependabot[bot]

This release was made possible by the following contributors:

@arnabrahman, @dependabot[bot], @dothomson, @dreamorosi, @felsidian, @github-actions[bot], @matthew2564, @nateiler, @sdangol, @svozza, dependabot[bot] and github-actions[bot]

Source: README.md, updated 2026-02-10