Releases: aws-powertools/powertools-lambda-typescript
v2.18.0
Summary
This release enhances the Parser experience with new schemas for Amazon Cognito User Pool triggers and Amazon API Gateway WebSocket APIs.
⭐️ Thanks to @VatsalGoel3 for working on all the new schemas added in this release, as well as @elliottohara and @vforgeone for their first contributions!
New Cognito Trigger Schemas
You can now use one of the new built-in schemas from Parser to easily work with events coming from Amazon Cognito to your Lambda function. With Amazon Cognito User Pools, you can configure triggers to invoke AWS Lambda functions, modifying the authentication behavior.
Below is a list of schemas we’ve added:
PreSignupTriggerSchema
PostConfirmationTriggerSchema
PreTokenGenerationTriggerSchema
CustomMessageTriggerSchema
MigrateUserTriggerSchema
CustomSMSTriggerSchema
CustomEmailTriggerSchema
DefineAuthChallengeTriggerSchema
CreateAuthChallengeTriggerSchema
VerifyAuthChallengeResponseTriggerSchema
PreTokenGenerationTriggerSchemaV1
PreTokenGenerationTriggerSchemaV2AndV3
For more information, refer to the Amazon Cognito User Pools documentation.
New API Gateway WebSocket Schema
Use the new APIGatewayProxyWebsocketEventSchema
built-in schema to work with Amazon API Gateway WebSocket APIs events. This is useful when building AWS Lambda functions that act as backend for web socket APIs.
Changes
🌟New features and non-breaking changes
- feat(parser): add schema support for API Gateway WebSocket events (#3807) by @VatsalGoel3
- feat(parser): add Cognito pre-signup trigger schema (#3729) by @VatsalGoel3
- feat: make getKey protected on DynamoDbPersistenceLayer (#3783) by @elliottohara
🌟 Minor Changes
- improv(parser): export all SQS schemas (#3782) by @vforgeone
📜 Documentation updates
- docs(parameters): clarify caching behavior of
getAppConfig
(#3808) by @dreamorosi - feat(parser): add schema support for API Gateway WebSocket events (#3807) by @VatsalGoel3
- chore(deps): bump aws-cdk-lib from 2.187.0 to 2.188.0 in the aws-cdk group across 1 directory (#3805) by @dependabot[bot]
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3804) by @dependabot[bot]
- chore(deps): bump @types/node from 22.13.17 to 22.14.0 (#3803) by @dependabot[bot]
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3802) by @dependabot[bot]
- chore(deps): bump @types/node from 22.13.16 to 22.13.17 (#3800) by @dependabot[bot]
- feat(parser): add Cognito pre-signup trigger schema (#3729) by @VatsalGoel3
- chore(deps): bump @types/node from 22.13.14 to 22.13.16 (#3798) by @dependabot[bot]
- chore(deps): bump mkdocs-material from 9.6.10 to 9.6.11 in /docs (#3795) by @dependabot[bot]
- chore(deps): bump squidfunk/mkdocs-material from
3555052
to23b6978
in /docs (#3794) by @dependabot[bot] - chore(deps): bump aws-cdk-lib from 2.186.0 to 2.187.0 in the aws-cdk group across 1 directory (#3797) by @dependabot[bot]
- chore(deps): bump esbuild from 0.25.1 to 0.25.2 (#3791) by @dependabot[bot]
- chore(deps): bump mkdocs-material from 9.6.9 to 9.6.10 in /docs (#3792) by @dependabot[bot]
- chore(deps): bump squidfunk/mkdocs-material from
f226a2d
to3555052
in /docs (#3788) by @dependabot[bot] - chore(deps): bump @aws-sdk/lib-dynamodb from 3.777.0 to 3.778.0 in the aws-sdk-v3 group across 1 directory (#3789) by @dependabot[bot]
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3786) by @dependabot[bot]
- chore(deps): bump aws-cdk-lib from 2.185.0 to 2.186.0 in the aws-cdk group across 1 directory (#3784) by @dependabot[bot]
- chore(deps): bump @types/node from 22.13.13 to 22.13.14 (#3785) by @dependabot[bot]
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3780) by @dependabot[bot]
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3779) by @dependabot[bot]
- docs: update roadmap end Q1 (#3776) by @dreamorosi
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3774) by @dependabot[bot]
🔧 Maintenance
- chore(deps): bump vite from 6.2.4 to 6.2.5 (#3806) by @dependabot[bot]
- chore(deps): bump aws-cdk-lib from 2.187.0 to 2.188.0 in the aws-cdk group across 1 directory (#3805) by @dependabot[bot]
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3804) by @dependabot[bot]
- chore(deps): bump @types/node from 22.13.17 to 22.14.0 (#3803) by @dependabot[bot]
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3802) by @dependabot[bot]
- chore(deps): bump @types/node from 22.13.16 to 22.13.17 (#3800) by @dependabot[bot]
- feat(parser): add Cognito pre-signup trigger schema (#3729) by @VatsalGoel3
- chore(deps): bump @types/node from 22.13.14 to 22.13.16 (#3798) by @dependabot[bot]
- chore(deps): bump mkdocs-material from 9.6.10 to 9.6.11 in /docs (#3795) by @dependabot[bot]
- chore(deps): bump squidfunk/mkdocs-material from
3555052
to23b6978
in /docs (#3794) by @dependabot[bot] - chore(deps): bump aws-cdk-lib from 2.186.0 to 2.187.0 in the aws-cdk group across 1 directory (#3797) by @dependabot[bot]
- chore(deps): bump actions/dependency-review-action from 4.5.0 to 4.6.0 (#3796) by @dependabot[bot]
- chore(deps): bump esbuild from 0.25.1 to 0.25.2 (#3791) by @dependabot[bot]
- chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.22 to 3.0.23 (#3793) by @dependabot[bot]
- chore(deps): bump mkdocs-material from 9.6.9 to 9.6.10 in /docs (#3792) by @dependabot[bot]
- chore(deps): bump squidfunk/mkdocs-material from
f226a2d
to3555052
in /docs (#3788) by @dependabot[bot] - chore(deps): bump @aws-sdk/lib-dynamodb from 3.777.0 to 3.778.0 in the aws-sdk-v3 group across 1 directory (#3789) by @dependabot[bot]
- chore(deps-dev): bump the vitest group across 1 directory with 2 updates (#3790) by @dependabot[bot]
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3786) by @dependabot[bot]
- chore(deps): bump aws-cdk-lib from 2.185.0 to 2.186.0 in the aws-cdk group across 1 directory (#3784) by @dependabot[bot]
- chore(deps): bump @types/node from 22.13.13 to 22.13.14 (#3785) by @dependabot[bot]
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3780) by @dependabot[bot]
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3779) by @dependabot[bot]
- chore(deps): bump actions/setup-python from 5.4.0 to 5.5.0 (#3773) by @dependabot[bot]
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3774) by @dependabot[bot]
This release was made possible by the following contributors:
v2.17.0
Summary
This release introduces the new Validation utility to validate payloads with JSON Schemas. This addition further reduces the feature gap between this version of Powertools for AWS Lambda and the more mature one in Python, and it’s also the first utility that was built primarily by community contributors, hats off to @VatsalGoel3!
The release also enhances Logger with correlation ID support, improves cold start reporting for Provisioned Concurrency, adds customizable function name dimensions for metrics, and extends Lambda layer availability to GovCloud (US) regions.
⭐️ Thanks to @VatsalGoel3 and @steven10172 for their contributions, and Guild for becoming a public reference customer!
New Validation utility
The new Validation utility helps you validate incoming events and responses using JSON Schemas. This is useful when you want request payloads to conform to expected formats. You can also verify that responses meet defined structures, ensuring consistency in both input and output.
Installation
npm i @aws-lambda-powertools/validation
Key Features
- JSON Schema validation (supports draft-07 by default, configurable to any version supported by Ajv
- Multiple implementation options:
- Class method decorator
@validator
- Middy.js middleware
validator
- Standalone
validate
function
- Class method decorator
- Flexible validation targets:
- Incoming requests
- Outbound responses
- Partial payload validation using JMESPath expressions
Examples
Using Middy.js middleware:
Using decorator with envelope extraction:
Error handling with standalone validation:
Learn more
Head over to the documentation to learn more about the utility and see more examples.
Set Correlation IDs in Logger
You can now extract and inject correlation IDs from incoming events into your logs using JMESPath expressions. This is useful when you want to enrich your log entries with keys that can help you correlate them with other systems of entities.
Key Features
- Automatic correlation ID extraction from common AWS event sources
- Custom JMESPath expressions for extracting IDs from any event structure
- Integration with Middy.js middleware, class method decorator, and standalone patterns
To ease routine tasks like extracting correlation ID from popular event sources, we also provide built-in JMESPath expressions.
Improved Cold Start Reporting with Provisioned Concurrency
Logger, Tracer, and Metrics utilities now correctly identify cold starts when using Provisioned Concurrency (PC). When PC is enabled, pre-initialized environments will correctly report cold start as false
.
Custom Function Name in Metrics Dimensions
You can now specify a custom function name to use as a dimension when emitting cold start metrics, ensuring consistent metrics even after Lambda function renames.
Lambda Layers in GovCloud (US) Regions
Powertools for AWS Lambda (TypeScript) layers are now available in these two GovCloud (US) regions:
Region | Location | ARN |
---|---|---|
us-gov-east-1 |
GovCloud East | arn:aws-us-gov:lambda:us-gov-east-1:165087284144:layer:AWSLambdaPowertoolsTypeScriptV2:23 |
us-gov-west-1 |
GovCloud West | arn:aws-us-gov:lambda:us-gov-west-1:165093116878:layer:AWSLambdaPowertoolsTypeScriptV2:23 |
You can use the AWS CLI to inspect the contents of the layer and read its metadata:
aws lambda get-layer-version-by-arn --arn arn:aws-us-gov:lambda:{aws::region}:{account-id}:layer:AWSLambdaPowertoolsTypeScriptV2:23 --region {aws::region}
Changes
- chore(ci): Simpllified GovCloud Deploy (#3763) by @sthulb
- test: fix transient fails in log sampling tests (#3736) by @dreamorosi
- chore(ci): remove old api copy step (#3725) by @dreamorosi
- chore(deps): bump github/codeql-action from 3.28.10 to 3.28.11 (#3708) by @dependabot[bot]
🌟New features and non-breaking changes
- feat(metrics): allow setting functionName via constructor parameter and environment variable (#3696) by @steven10172
- feat(commons): make utilities aware of provisioned concurrency (#3724) by @dreamorosi
- feat(logger): set correlation ID in Logger (#3726) by @am29d
📜 Documentation updates
- chore(parameters): update AWS SDK client type (#3768) by @dreamorosi
- chore(deps): bump @types/aws-lambda from 8.10.147 to 8.10.148 (#3767) by @dependabot[bot]
- chore(deps): bump @types/node from 22.13.11 to 22.13.13 (#3766) by @dependabot[bot]
- chore: add Guild customer reference (#3769) by @dreamorosi
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3757) by @dependabot[bot]
- chore(deps): bump @types/node from 22.13.10 to 22.13.11 (#3758) by @dependabot[bot]
- chore(layers): add workflows for govcloud layers (#3747) by @am29d
- chore(deps): bump aws-cdk-lib from 2.184.1 to 2.185.0 in the aws-cdk group across 1 directory (#3750) by @dependabot[bot]
- feat(metrics): allow setting functionName via constructor parameter and environment variable (#3696) by @steven10172
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3743) by @dependabot[bot]
- chore(logger): clear prev request buffers in manual mode (#3742) by @dreamorosi
- fix(parser): ddb base schema + other exports (#3741) by @dreamorosi
- chore(deps): bump mkdocs-material from 9.6.8 to 9.6.9 in /docs (#3731) by @dependabot[bot]
- chore(deps): bump squidfunk/mkdocs-material from
479a06a
tof226a2d
in /docs (#3732) by @dependabot[bot] - chore(deps): bump mkdocs-material from 9.6.7 to 9.6.8 in /docs (#3721) by @dependabot[bot]
- chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#3728) by @dependabot[bot]
- chore(deps): bump squidfunk/mkdocs-material from
047452c
to479a06a
in /docs (#3719) by @dependabot[bot] - chore(deps): bump the aws-sdk-v3 group across 1 directory with 3 updates (#3727) by @dependabot[bot]
- feat(logger): set correlation ID in Logger (#3726) by @am29d
- fix(logger): correctly refresh sample rate (#3722) by @dreamorosi
- docs(validation): add main docs page (#3717) by @dreamorosi
- chore(deps): bump the typescript group across 1 directory with 2 updates (#3688) by @dependabot[bot]
- chore(deps): bump @types/node from 22.13.9 to 22.13.10 (#3706) by @dependabot[bot]
- chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#3699) by @dependabot[bot]
- chore(deps): bump esbuild from 0.25.0 to 0.25.1 (#3707) by @dependabot[bot]
- chore: add api docs in mkdocs build (#3715) by @dreamorosi
🐛 Bug and hot fixes
- fix(ci): region typo in govcloud (#3762) by @sthulb
- fix(ci): GovCloud formatting change (#3761) by @sthulb
- fix(ci): Switch GovCloud publish-layer-version to --cli-input-json (#3760) by @sthulb
- chore(ci): fix compat runtimes in govcloud layer creation (#3759) by @sthulb
- fix(ci): Remove --compatible-architectures from workflow (#3752) by @sthulb
- fix(parser): ddb base schema + other exports (#3741) by @dreamorosi
- fix(logger): correctly refresh sample rate (#3722) by @dreamorosi
- fix(idempotency): include sk in error msgs when using composite key (#3709) by @dreamorosi
🔧 Maintenance
- chore(parameters): update AWS SDK client type (#3768) by @dreamorosi
- chore(deps): bump @types/aws-lambda from 8.10.147 to 8.10.148 (#3767) by @dependabot[bot]
- chore(deps): bump github/codeql-action from 3.28.12 to 3.28.13 (#3764) by @dependabot[bot]
- chore(deps): bump @types/node from 22.13.11 to 22.13.13 (#3766) by @dependabot[bot]
- chore: add Guild customer reference (#3769) by @dreamorosi
- chore(deps-dev): bump the typescript group across 1 directory with 2 updates (#3753) by @dependabot[bot]
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3757) by @dependabot[bot]
- chore(dep...
v2.16.0
Summary
We are excited to announce a new feature in Logger: Logger buffering. This new feature allows you to buffer logs for a specific invocation, and flush them automatically on error or manually as needed.
We also fixed a bug in the Batch Processing utility that prevented SQS FIFO messages from the same group to be processed correctly during retries
Finally, we now publish our Lambda layers to three new regions Mexico (mx-central-1
), Thailand (ap-southeast-7
), and Malaysia (ap-southeast-5
).
⭐️ Thanks to @VatsalGoel3 and @ConnorKirk for their significant contributions to this release!
New Log Buffering feature
You can now enable log buffering by passing logBufferOptions
when initializing a new Logger instance. This feature allows you to:
- Buffer logs at the
WARN
,INFO
,DEBUG
, andTRACE
levels - Automatically flush logs on error or manually as needed
- Reduce CloudWatch costs by decreasing the number of emitted log messages
Configuration options
Option | Description | Default |
---|---|---|
maxBytes |
Maximum size of the buffer in bytes | 20480 |
minLevel |
Minimum log level to buffer (more verbose levels are also buffered) | DEBUG |
flushOnErrorLog |
Whether to flush buffer when an error is logged | true |
enabled |
Whether log buffering is enabled | N/A |
When log buffering is enabled, you can now pass a new opt-in flushBufferOnUncaughtError
flag to the injectLambdaContext()
class method decorator and Middy.js middleware. When enabled, 1/ we'll intercept any error thrown, 2/ flush the buffer, and 3/ re-throw your original error. This enables you to have detailed logs from your application when you need them the most.
For detailed explanations with diagrams, please refer to our comprehensive documentation.
Buffering FAQs
Q: Does the buffer persist across Lambda invocations?
A: No. Each Lambda invocation has its own buffer. The buffer initializes when the Lambda function is invoked and clears after function completion or manual flushing.
Q: Are my logs buffered during cold starts?
A: No. We never buffer logs during cold starts to ensure all logs from this phase are immediately available for debugging.
Q: How can I prevent log buffering from consuming excessive memory?
A: You can limit the size of the buffer by setting the maxBytes option in the logBufferOptions constructor parameter. This will ensure that the buffer does not grow indefinitely and consume excessive memory.
Q: What happens if the log buffer reaches its maximum size?
A: Older logs are removed from the buffer to make room for new logs. This means that if the buffer is full, you may lose some logs if they are not flushed before the buffer reaches its maximum size. When this happens, we emit a warning when flushing the buffer to indicate that some logs have been dropped.
Q: What timestamp is used when I flush the logs?
A: The timestamp preserves the original time when the log record was created. If you create a log record at 11:00:10 and flush it at 11:00:25, the log line will retain its original timestamp of 11:00:10.
Q: What happens if I try to add a log line that is bigger than max buffer size?
A: The log will be emitted directly to standard output and not buffered. When this happens, we emit a warning to indicate that the log line was too big to be buffered.
Q: What happens if Lambda times out without flushing the buffer?
A: Logs that are still in the buffer will be lost. If you are using the log buffer to log asynchronously, you should ensure that the buffer is flushed before the Lambda function times out. You can do this by calling the logger.flushBuffer() method at the end of your Lambda function.
Q: Do child loggers inherit the buffer?
A: No, child loggers do not inherit the buffer from their parent logger but only the buffer configuration. This means that if you create a child logger, it will have its own buffer and will not share the buffer with the parent logger.
Lambda layers in 3 new regions
Powertools for AWS Lambda (TypeScript) layers are now available in these additional regions:
Region | Location | ARN |
---|---|---|
mx-central-1 |
Mexico | arn:aws:lambda:mx-central-1:094274105915:layer:AWSLambdaPowertoolsTypeScriptV2:22 |
ap-southeast-5 |
Malaysia | arn:aws:lambda:ap-southeast-5:094274105915:layer:AWSLambdaPowertoolsTypeScriptV2:22 |
ap-southeast-7 |
Thailand | arn:aws:lambda:ap-southeast-7:094274105915:layer:AWSLambdaPowertoolsTypeScriptV2:22 |
You can also dynamically look up the latest layer ARNs using SSM Parameters:
Parameter | Description |
---|---|
/aws/service/powertools/typescript/generic/all/latest | Most recent layer version |
/aws/service/powertools/typescript/generic/all/ | Specific version (e.g., 2.16.0) |
You can use the SSM Parameter with the AWS CLI:
aws ssm get-parameter --name=/aws/service/powertools/typescript/generic/all/latest
or directly in your infrastructure template, below an example using AWS CDK:
const powertoolsLayerArn = StringParameter.fromStringParameterAttributes(self, 'PTLayerArn', {
parameterName: '/aws/service/powertools/typescript/generic/all/latest'
})
Bug fix when working with SQS FIFO queues
Issue Resolved: When processing SQS FIFO queue messages with the Batch Processing utility, messages from failing groups were not being correctly retried within the same Lambda sandbox.
Impact: This fix ensures consistent behavior when:
- Working with SQS FIFO queues
- Using the Batch Processing utility
- Processing fails for a message from a specific group
- Retries occur within the same Lambda sandbox
Configuration: No changes required. The fix is automatically applied when using version 2.16.0 or later.
Changes
- chore(maintenance): simplify Utility class (#3682) by @dreamorosi
- chore(deps): bump actions/download-artifact from 4.1.8 to 4.1.9 (#3663) by @dependabot[bot]
- feat(logger): Enable log buffering feature (#3641) by @ConnorKirk
- chore(deps): bump actions/upload-artifact from 4.6.0 to 4.6.1 (#3649) by @dependabot[bot]
- chore(deps): bump github/codeql-action from 3.28.9 to 3.28.10 (#3648) by @dependabot[bot]
- chore(deps): bump ossf/scorecard-action from 2.4.0 to 2.4.1 (#3647) by @dependabot[bot]
- chore(deps): bump actions/setup-python from 5.3.0 to 5.4.0 (#3631) by @dependabot[bot]
🌟New features and non-breaking changes
- feat(logger): Flush buffer on uncaught error in Middy middleware (#3690) by @ConnorKirk
- feat(logger): flush buffer on uncaught error decorator (#3676) by @dreamorosi
- feat(logger): refresh sample rate calculation before each invocation (#3672) by @am29d
🌟 Minor Changes
- refactor(logger): align implementation to spec + docs (#3701) by @dreamorosi
📜 Documentation updates
- refactor(logger): align implementation to spec + docs (#3701) by @dreamorosi
- chore(deps): bump jinja2 from 3.1.5 to 3.1.6 in /docs (#3698) by @dependabot[bot]
- chore(deps): bump @types/node from 22.13.8 to 22.13.9 (#3695) by @dependabot[bot]
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3687) by @dependabot[bot]
- chore(deps): bump squidfunk/mkdocs-material from
2615302
to047452c
in /docs (#3685) by @dependabot[bot] - chore(deps): bump mkdocs-material from 9.6.5 to 9.6.7 in /docs (#3686) by @dependabot[bot]
- chore(deps): bump @types/node from 22.13.5 to 22.13.8 (#3689) by @dependabot[bot]
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3681) by @dependabot[bot]
- chore(deps): bump the aws-cdk group across 1 directory with 3 updates (#3677) by @dependabot[bot]
- feat(logger): refresh sample rate calculation before each invocation (#3672) by @am29d
- chore: add new AWS regions to layer workflow and documentation (#3659) by @am29d
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3656) by @dependabot[bot]
- chore(deps): bump @types/node from 22.13.4 to 22.13.5 (#3646) by @dependabot[bot]
- chore(deps): bump mkdocs-material from 9.6.4 to 9.6.5 in /docs (#3638) by @dependabot[bot]
- chore(deps): bump squidfunk/mkdocs-material from
f5bcec4
to2615302
in /docs (#3637) by @dependabot[bot]
🐛 Bug and hot fixes
- fix(batch): clear message group references after request (#3674) by @dreamorosi
- fix(parser): Update S3 Event Schema (#3671) by @ConnorKirk
- fix(parser): envelope sub-path exports regression (#3667) by @dreamorosi
- fix(ci): Update layer balance scripts (#3660) by @sthulb
#...
v2.15.0
Summary
This minor release improves the Idempotency utility by adding support for custom key prefixes. It also fixes a regression in Logger that caused runtime errors when passing an undefined
or null
value as extra argument.
⭐️ Thanks to @ConnorKirk, @VatsalGoel3, and @shdq for their contributions to this release!
Custom Idempotency Key Prefix Support
The makeIdempotent
, @idempotent
decorator, and makeHandlerIdempotent
Middy.js middleware now support an optional keyPrefix parameter, allowing you to define custom prefixes for idempotency keys. With this feature, you can implement cross-function idempotency, group related operations under a common prefix, and ensure your idempotency records remain stable during code refactoring or Lambda function renaming.
It allows you to override the default idempotency key prefix, which is typically a combination of Lambda function and function names. By specifying a custom prefix, you gain more control over the idempotency key structure.
Logging undefined
or null
arguments
In v2.13.1 we introduced a regression that caused runtime errors when passing undefined
or null
as extra arguments. This edge case could happen only when not using TypeScript or when passing arguments with broad types like any
or unknown
, since the types in all the logging methods already prevent you from passing these values. In this release we have fixed the regression so that Logger handles these values correctly.
Changes
- chore(maintenance): set app sdk ua env variable when none is set (#3651) by @dreamorosi
- chore(deps): bump actions/setup-node from 4.1.0 to 4.2.0 (#3630) by @dependabot[bot]
- chore(deps): bump aws-actions/configure-aws-credentials from 4.0.2 to 4.1.0 (#3629) by @dependabot[bot]
- chore(deps): bump release-drafter/release-drafter from 6.0.0 to 6.1.0 (#3628) by @dependabot[bot]
- chore(deps): bump actions/upload-artifact from 4.5.0 to 4.6.0 (#3622) by @dependabot[bot]
- chore(deps): bump actions/stale from 9.0.0 to 9.1.0 (#3621) by @dependabot[bot]
- chore(deps): bump actions/setup-go from 5.2.0 to 5.3.0 (#3620) by @dependabot[bot]
- chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.18 to 3.0.22 (#3619) by @dependabot[bot]
- chore(deps): bump github/codeql-action from 3.27.9 to 3.28.9 (#3618) by @dependabot[bot]
- chore(ci): fix double
@
in action hash (#3587) by @dreamorosi
🌟New features and non-breaking changes
- chore: revert "feat(logger): refresh sample rate calculation per invocation" (#3652) by @dreamorosi
- feat(logger): refresh sample rate calculation per invocation (#3644) by @am29d
- feat(logger): Emit a warning on buffer flush (#3639) by @ConnorKirk
- feat(logger): Add log buffer and flush method (#3617) by @ConnorKirk
- feat(idempotency): add support for custom key prefix (#3532) by @shdq
- feat(parser): provide sub-path exports (#3598) by @am29d
- feat(logger): add circular buffer (#3593) by @VatsalGoel3
📜 Documentation updates
- chore: revert "feat(logger): refresh sample rate calculation per invocation" (#3652) by @dreamorosi
- feat(logger): refresh sample rate calculation per invocation (#3644) by @am29d
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3627) by @dependabot[bot]
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3626) by @dependabot[bot]
- chore(deps): bump tsx from 4.19.2 to 4.19.3 (#3624) by @dependabot[bot]
- chore: Add sitemap to documentation website (#3603) by @hjgraca
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3612) by @dependabot[bot]
- docs(validation): add draft of feature page (#3606) by @dreamorosi
- docs(idempotency): document keyPrefix feature (#3611) by @dreamorosi
- docs(logger): add notice about mutating attributes in log formatter (#3604) by @dreamorosi
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3599) by @dependabot[bot]
- chore(deps): bump mkdocs-material from 9.6.3 to 9.6.4 in /docs (#3594) by @dependabot[bot]
- chore(deps): bump @types/node from 22.13.2 to 22.13.4 (#3601) by @dependabot[bot]
- chore(deps): bump @types/node from 22.13.1 to 22.13.2 (#3600) by @dependabot[bot]
- chore(deps): bump squidfunk/mkdocs-material from
c62453b
tof5bcec4
in /docs (#3596) by @dependabot[bot] - docs: update roadmap (#3578) by @dreamorosi
🐛 Bug and hot fixes
- fix(logger): handle illegal
null
/undefined
as extra args (#3614) by @dreamorosi - fix(ci): Add permissions to jobs (#3586) by @sthulb
- fix(ci): Fix path for latest SSM param (#3585) by @sthulb
🔧 Maintenance
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3627) by @dependabot[bot]
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3626) by @dependabot[bot]
- chore(deps-dev): bump the vitest group across 1 directory with 2 updates (#3623) by @dependabot[bot]
- chore(deps): bump tsx from 4.19.2 to 4.19.3 (#3624) by @dependabot[bot]
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3612) by @dependabot[bot]
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3599) by @dependabot[bot]
- chore(deps): bump @types/node from 22.13.2 to 22.13.4 (#3601) by @dependabot[bot]
- feat(parser): provide sub-path exports (#3598) by @am29d
- chore(deps): bump @types/node from 22.13.1 to 22.13.2 (#3600) by @dependabot[bot]
- chore(deps-dev): bump zod from 3.24.1 to 3.24.2 (#3595) by @dependabot[bot]
- chore(validation): add workspace pkg (#3592) by @dreamorosi
This release was made possible by the following contributors:
@ConnorKirk, @VatsalGoel3, @am29d, @dreamorosi, @hjgraca, @shdq, and @sthulb
v2.14.0
Summary
In this release we fixed a bug in Logger that allowed customer keys to replace service keys in logs and potentially leading to data loss. We also improved the Parser experience by adding a new schema for AWS Transfer Family and updated how we parse S3 Notification events delivered via SQS.
Finally, we also started publishing public SSM Parameters to easily look up Lambda layer ARNs 🔥
⭐️ Thanks to @VatsalGoel3 and @cyrildewit for their contributions to this release!
Working with S3 events delivered via SQS
When sending S3 Notification events to SQS, the events are JSON-serialized and delivered as strings in the SQS message body. We have updated the S3SqsEventNotificationSchema
built-in schema to correctly transform the message body into an object during event parsing, fixing this bug in the original implementation.
New AWS Transfer Family schema
You can now work with AWS Transfer Family events using the new TransferFamilySchema
built-in schema. This is useful when building Lambda functions that act as custom authorizers for AWS Transfer Family.
Prevent overwriting Logger standard keys
Before this release, customers could overwrite the standard Logger keys such as level, message, service or even timestamp
with their own value. In most cases this was unintentional and there was no warning, so customers could not find their expected logs and would not notice this issue. Now, the standard log keys are considered as reserved and any attempt to overwrite them will log a warning.
Lambda layer SSM Parameter lookup
You can now use our public SSM Parameters to easily look up the ARNs for our Powertools for AWS Lambda layers. For example, you can use the /aws/service/powertools/typescript/generic/all/latest
to fetch the ARN of the current latest layer or /aws/service/powertools/typescript/generic/all/<semantic-version>
to get the one for a specific version published on npmjs.com.
This makes it easy to attach the layer to your functions without having to look at the documentation. You can fetch the ARN using the AWS CLI:
aws ssm get-parameter --name=/aws/service/powertools/typescript/generic/all/latest
Or perform the lookup directly in your IaC template, below is an example of how to use it with AWS CDK but you can do the same with AWS SAM, Terraform, and plain CloudFormation templates among others:
const powertoolsLayerArn = StringParameter.fromStringParameterAttributes(self, 'PTLayerArn', {
parameterName: '/aws/service/powertools/typescript/generic/all/latest'
})
Changes
- chore(ci): remove pinned actions & pkg versions (#3576) by @dreamorosi
- chore: update
actions/cached-node-modules
GitHub Action (#3549) by @dreamorosi - chore(layers): add compatible architecture field (#3544) by @dreamorosi
🌟New features and non-breaking changes
- feat(parser): add TransferFamilySchema for AWS Transfer Family events (#3575) by @VatsalGoel3
- feat(ci): Add advanced automation (#3438) by @sthulb
- feat(parser): simplify
ParseResult
andparse
inference (#3568) by @am29d - fix(parser): parse sqs record body field as JSON and S3Schema in S3SqsEventNoificationRecordSchema (#3529) by @cyrildewit
🌟 Minor Changes
- improv(parser): allow extending base provider with no AWS SDK client (#3564) by @dreamorosi
- improv(logger): switch key order for better readability (#3560) by @dreamorosi
- improv(idempotency): mark
getHashedIdempotencyKey()
method as protected (#3552) by @dreamorosi
📜 Documentation updates
- docs: update roadmap (#3578) by @dreamorosi
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3579) by @dependabot
- chore(deps): bump esbuild from 0.24.2 to 0.25.0 (#3581) by @dependabot
- docs: add SSM examples to docs (#3577) by @sthulb
- feat(parser): add TransferFamilySchema for AWS Transfer Family events (#3575) by @VatsalGoel3
- chore(deps): bump squidfunk/mkdocs-material from
7e841df
toc62453b
in /docs (#3571) by @dependabot - chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3569) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3570) by @dependabot
- chore(deps): bump mkdocs-material from 9.6.2 to 9.6.3 in /docs (#3572) by @dependabot
- chore(deps): bump squidfunk/mkdocs-material from
471695f
to7e841df
in /docs (#3557) by @dependabot - chore(deps): bump mkdocs-material from 9.6.1 to 9.6.2 in /docs (#3554) by @dependabot
- chore(docs): enable privacy plugin in docs (#3567) by @dreamorosi
- improv(parser): allow extending base provider with no AWS SDK client (#3564) by @dreamorosi
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 10 updates (#3559) by @dependabot
- chore(deps): bump @types/node from 22.12.0 to 22.13.1 (#3556) by @dependabot
- chore: migrate to vitest v3 (#3561) by @dreamorosi
- improv(logger): switch key order for better readability (#3560) by @dreamorosi
- fix(logger): prevent overwriting standard keys (#3553) by @dreamorosi
- chore(deps): bump mkdocs-material from 9.5.50 to 9.6.1 in /docs (#3547) by @dependabot
- chore(deps): bump squidfunk/mkdocs-material from
41942f7
to471695f
in /docs (#3546) by @dependabot - chore(deps): bump the aws-sdk-v3 group across 1 directory with 10 updates (#3545) by @dependabot
- chore(deps): bump typescript from 5.7.2 to 5.7.3 in the typescript group across 1 directory (#3465) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3535) by @dependabot
- chore(deps): bump @types/node from 22.10.7 to 22.12.0 (#3538) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3536) by @dependabot
🐛 Bug and hot fixes
- fix(ci): Fix path for latest SSM param (#3585) by @sthulb
- fix(logger): prevent overwriting standard keys (#3553) by @dreamorosi
- fix(parser): parse sqs record body field as JSON and S3Schema in S3SqsEventNoificationRecordSchema (#3529) by @cyrildewit
🔧 Maintenance
- chore(deps-dev): bump typedoc from 0.27.6 to 0.27.7 in the typescript group across 1 directory (#3580) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3579) by @dependabot
- chore(deps): bump esbuild from 0.24.2 to 0.25.0 (#3581) by @dependabot
- feat(parser): add TransferFamilySchema for AWS Transfer Family events (#3575) by @VatsalGoel3
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3569) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3570) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 10 updates (#3559) by @dependabot
- chore(deps): bump @types/node from 22.12.0 to 22.13.1 (#3556) by @dependabot
- chore: migrate to vitest v3 (#3561) by @dreamorosi
- chore(deps): bump aws-xray-sdk-core from 3.10.2 to 3.10.3 (#3542) by @dependabot
- chore(deps-dev): bump lint-staged from 15.4.2 to 15.4.3 (#3543) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 10 updates (#3545) by @dependabot
- chore(deps): bump typescript from 5.7.2 to 5.7.3 in the typescript group across 1 directory (#3465) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3535) by @dependabot
- chore(deps): bump @types/node from 22.10.7 to 22.12.0 (#3538) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3536) by @dependabot
This release was made possible by the following contributors:
@VatsalGoel3, @am29d, @cyrildewit, @dependabot, @dependabot[bot], @dreamorosi, @github-actions, @github-actions[bot] and @sthulb
v2.13.1
Summary
This patch release fixes a number of bugs in all the built-in envelopes in the Parser utility so that they can now handle payloads of different formats including plain text and base64-encoded strings.
⭐️ Thanks to @svozza for their contributions to this release!
Parser bug fixes
Starting with this release, Parser’s built-in envelopes treat event payloads as strings, enabling Zod transformations. Previously, they incorrectly treated all payloads as JSON strings, causing runtime errors for plain text or base64-encoded strings.
For example, when working with API Gateway events, use the ApiGatewayEnvelope
with the JSONStringified
Zod helper to automatically transform the payload before parsing. This is useful when you expect the payload to be a JSON string and want to parse its contents using a schema without code transformation.
This feature applies to all built-in envelopes, and additional helpers will be added based on customer demand.
Event Handler Request for Comments (RFC)
We are excited to share that we have published the RFC for Event Handler, an upcoming utility that helps you write REST APIs for Amazon API Gateway REST and HTTP APIs, Application Load Balancer (ALB), Lambda Function URLs, and VPC Lattice.
We’d like everyone interested in our most requested feature to review the RFC and share their feedback. We’re seeing good engagement, so we’ll keep the RFC open for a couple more weeks before starting implementation.
Changes
- chore(parser): deprecate
AlbMultiValueHeadersSchema
(#3523) by @dreamorosi
🌟 Minor Changes
- improv(parser): export APIGatewayEventRequestContextSchema (#3507) by @dreamorosi
📜 Documentation updates
- chore(deps): bump squidfunk/mkdocs-material from
ba73db5
to41942f7
in /docs (#3501) by @dependabot - chore(deps): bump mkdocs-material from 9.5.49 to 9.5.50 in /docs (#3502) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 10 updates (#3495) by @dependabot
- chore(deps): bump @types/node from 22.10.5 to 22.10.7 (#3479) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3477) by @dependabot
- chore(ci): update layer ARN on documentation (#3474) by @dreamorosi
- chore(deps): bump the aws-cdk group (#3472) by @dreamorosi
🐛 Bug and hot fixes
- fix(parser): allow VPC envelopes to handle non-JSON strings (#3534) by @dreamorosi
- fix(parser): allow Kinesis envelopes to handle non-JSON strings (#3531) by @dreamorosi
- fix(parser): Firehose SQS should fail for invalid SQS message (#3526) by @am29d
- fix(parser): min array length on Records (#3521) by @dreamorosi
- fix(parser): set min length of 1 to s3 event lists (#3524) by @dreamorosi
- fix(parser): allow SQS envelopes to handle non-JSON strings (#3513) by @dreamorosi
- fix(parser): LambdaFunctionUrl envelope assumes JSON string in body (#3514) by @am29d
- fix(parser): API Gateway Envelopes handle non-JSON (#3511) by @dreamorosi
- fix(parser): CloudWatch Log Envelope handles non-JSON (#3505) by @dreamorosi
- fix(parser): SNS Envelope handles non-JSON (#3506) by @dreamorosi
- fix(parser): EventBridge envelope uses correct path (#3504) by @dreamorosi
- fix(parser): Kafka Envelope + tests (#3489) by @dreamorosi
- fix(parser): DynamoDBStream schema & envelope (#3482) by @dreamorosi
- fix(parser): identitySource can be null in APIGatewayRequestAuthorizerEventV2Schema (#3485) by @am29d
🔧 Maintenance
- fix(parser): allow VPC envelopes to handle non-JSON strings (#3534) by @dreamorosi
- chore(deps-dev): bump markdownlint-cli2 from 0.17.1 to 0.17.2 (#3498) by @dependabot
- chore(deps-dev): bump lint-staged from 15.3.0 to 15.4.2 (#3517) by @dependabot
- chore(deps): bump vite from 5.4.11 to 5.4.14 (#3508) by @dependabot
- chore(deps): bump aws-cdk-lib & co (#3496) by @dreamorosi
- chore(parser): replace util-dynamodb with commons package (#3493) by @am29d
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 10 updates (#3495) by @dependabot
- chore(deps): bump @types/node from 22.10.5 to 22.10.7 (#3479) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3477) by @dependabot
- chore(deps-dev): bump katex from 0.16.19 to 0.16.21 (#3491) by @dependabot
- fix(parser): DynamoDBStream schema & envelope (#3482) by @dreamorosi
- chore(parser): remove faker dependency (#3476) by @svozza
- chore(deps): bump the aws-cdk group (#3472) by @dreamorosi
This release was made possible by the following contributors:
@am29d, @dependabot, @dependabot[bot], @dreamorosi, @github-actions, @github-actions[bot] and @svozza
v2.13.0
Summary
In this release we fixed a bug in Tracer that prevented Fetch API requests from propagating the parent trace. We also improved the Parser experience by adding a helper to easily write Zod schemas for DynamoDB data structures.
⭐️ Thanks to @arnabrahman for their contributions to this release!
Full traces when working with Fetch API
Requests made with the global fetch module now adds X-Ray trace info to requests in the X-Amzn-Trace-Id
header. This allows X-Ray to construct a full trace that includes upstream and downstream nodes.
Zod schemas with Amazon DynamoDB Attributes
You can now easily extend DynamoDB Stream schemas with your own payloads using the new DynamoDBMarshalled helper. This helper lets you focus on your schemas while we handle unmarshalling data from DynamoDB Attribute format to the native format before Zod parses the payload.
Changes
- test(parser): refactor appsync schema tests (#3388) by @svozza
- chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.17 to 3.0.18 (#3430) by @dependabot
- chore(deps): bump actions/upload-artifact from 4.4.3 to 4.5.0 (#3437) by @dependabot
🌟New features and non-breaking changes
- feat(parser):
DynamoDBMarshalled
helper to parse DynamoDB data structure (#3442) by @arnabrahman
🌟 Minor Changes
- refactor(metrics): swap
isDate
forinstanceof Date
(#3462) by @dreamorosi
📜 Documentation updates
- chore(ci): update layer ARN on documentation (#3474) by @dreamorosi
- chore(deps): bump the aws-cdk group (#3472) by @dreamorosi
- feat(parser):
DynamoDBMarshalled
helper to parse DynamoDB data structure (#3442) by @arnabrahman - chore(deps): bump the typescript group across 1 directory with 4 updates (#3446) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 11 updates (#3459) by @dependabot
- chore(deps): bump @types/node from 22.10.2 to 22.10.5 (#3456) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3455) by @dependabot
- chore(deps): bump @types/aws-lambda from 8.10.146 to 8.10.147 (#3457) by @dependabot
- chore(deps): bump esbuild from 0.24.0 to 0.24.2 (#3443) by @dependabot
- chore(deps): bump jinja2 from 3.1.4 to 3.1.5 in /docs (#3453) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3452) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 10 updates (#3451) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3435) by @dependabot
- chore(deps): bump squidfunk/mkdocs-material from
d485eb6
toba73db5
in /docs (#3429) by @dependabot - chore(deps): bump mkdocs-material from 9.5.48 to 9.5.49 in /docs (#3427) by @dependabot
🐛 Bug and hot fixes
- fix(tracer): forward
X-Amzn-Trace-Id
header when instrumenting fetch (#3470) by @dreamorosi
🔧 Maintenance
- chore(deps): bump the aws-cdk group (#3472) by @dreamorosi
- feat(parser):
DynamoDBMarshalled
helper to parse DynamoDB data structure (#3442) by @arnabrahman - chore(deps-dev): bump lint-staged from 15.2.11 to 15.3.0 (#3460) by @dependabot
- chore(deps): bump the typescript group across 1 directory with 4 updates (#3446) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 11 updates (#3459) by @dependabot
- chore(deps): bump @types/node from 22.10.2 to 22.10.5 (#3456) by @dependabot
- chore(deps): bump @aws-cdk/cli-lib-alpha to 2.174.1-alpha.0 (#3458) by @dreamorosi
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3455) by @dependabot
- chore(deps): bump @types/aws-lambda from 8.10.146 to 8.10.147 (#3457) by @dependabot
- chore(deps): bump esbuild from 0.24.0 to 0.24.2 (#3443) by @dependabot
- chore(deps-dev): bump markdownlint-cli2 from 0.16.0 to 0.17.1 (#3450) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3452) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 10 updates (#3451) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3435) by @dependabot
This release was made possible by the following contributors:
@arnabrahman, @dependabot, @dependabot[bot], @dreamorosi, @github-actions, @github-actions[bot] and @svozza
v2.12.0
Summary
In this release we have made the Logger class more extensible, added POWERTOOLS_METRICS_DISABLED
to control metrics output in non production environment, and added AppSyncResolverSchema
and KinesisDynamoDBStreamSchema
to the parser utility.
⭐️ Thanks to @zirkelc and @svozza for their contributions to this release!
Logger class is now more extensible
You can now overwrite the Logger methods createAndPopulateLogItem
, printLog
, processLogItem
, which were private before. This allows you to extend the Logger and add new functionality, i.e. implement your own message buffer.
Metrics utility improvements
You can now set POWERTOOLS_METRICS_DISABLED
to control the metrics output. This is useful when you don't want to emit metrics in a non-production environment. When POWERTOOLS_DEV
is enabled, the metrics are also suppressed, but you can always explicitly enable it with POWERTOOLS_METRICS_DISABLED
.
We have also added a warning message when you overwrite a dimension with the same key, which will help you to troubleshoot unintentional changes:
import { Metrics } from '@aws-lambda-powertools/metrics';
const metrics = new Metrics({ singleMetric: true });
metrics.addDimension('test', 'foo');
metrics.addDimension('test', 'bar'); // "bar" replaces "foo"
// warning: Dimension "test" has already been added. The previous value will be overwritten.
New schema for AppSync and DynamoDB events
You can now use AppSyncResolverSchema
and AppSyncResolverBatchSchema
to parse AppSync Lambda resolver event.
We have also added KinesisDynamoDBStreamSchema
to validate the event from the invocation chain of DynamoDB, Kinesis and Lambda, which are slightly different compared to direct DynamoDB Streams invocations, see more details in #3193.
Changes
- chore(deps): bump github/codeql-action from 3.27.7 to 3.27.9 (#3422) by @dependabot
- chore(deps): bump github/codeql-action from 3.27.5 to 3.27.7 (#3411) by @dependabot
- chore(deps): bump actions/setup-node from 4.0.4 to 4.1.0 (#3380) by @dependabot
- chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.16 to 3.0.17 (#3362) by @dependabot
- chore: replace close-issue-message action (#3364) by @dreamorosi
- chore(deps): bump github/codeql-action from 3.27.3 to 3.27.5 (#3336) by @dependabot
- chore(parser): return correct type for safeParse in envelopes (#3339) by @jharlow
- chore(deps): bump actions/dependency-review-action from 4.4.0 to 4.5.0 (#3344) by @dependabot
- chore(deps): bump aws-actions/closed-issue-message from 80edfc24bdf1283400eb04d20a8a605ae8bf7d48 to 37548691e7cc75ba58f85c9f873f9eee43590449 (#3345) by @dependabot
🌟New features and non-breaking changes
- feat(logger): change visibility to protected (#3377) by @zirkelc
- feat(metrics): disable metrics with
POWERTOOLS_METRICS_DISABLED
(#3351) by @zirkelc - feat(metrics): warn when overwriting dimension (#3352) by @dreamorosi
- feat(parser): Add appsync resolver event Zod schemas (#3301) by @svozza
- feat(parser): add schema for DynamoDB - Kinesis Stream event (#3328) by @am29d
📜 Documentation updates
- chore(deps): bump @types/node from 22.10.1 to 22.10.2 (#3420) by @dependabot
- docs: add videos section in community (#3416) by @dreamorosi
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3413) by @dependabot
- chore(deps): bump mkdocs-material from 9.5.46 to 9.5.48 in /docs (#3404) by @dependabot
- chore(deps): bump squidfunk/mkdocs-material from
d063d84
tod485eb6
in /docs (#3407) by @dependabot - chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3412) by @dependabot
- docs: fix link to parser sub page in the README (#3403) by @having-fun-serverless
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 2 updates (#3395) by @dependabot
- docs: multiple minor improvements (#3387) by @dreamorosi
- chore(deps): bump @types/aws-lambda from 8.10.145 to 8.10.146 (#3370) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3381) by @dependabot
- chore(deps): bump @types/node from 22.10.0 to 22.10.1 (#3384) by @dependabot
- chore: remove jest from codebase (#3379) by @dreamorosi
- chore: move RFCs to discussions (#3373) by @dreamorosi
- chore(deps): bump mkdocs-material from 9.5.45 to 9.5.46 in /docs (#3356) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3357) by @dependabot
- chore(deps): bump @types/node from 22.9.0 to 22.10.0 (#3365) by @dependabot
- chore(deps): bump squidfunk/mkdocs-material from
ce587cb
tod063d84
in /docs (#3366) by @dependabot - chore(deps): bump the aws-sdk-v3 group across 1 directory with 4 updates (#3349) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3348) by @dependabot
- feat(parser): add schema for DynamoDB - Kinesis Stream event (#3328) by @am29d
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3343) by @dependabot
🐛 Bug and hot fixes
- fix(parser): make SNS subject field nullish (#3415) by @dreamorosi
🔧 Maintenance
- chore(deps-dev): bump markdownlint-cli2 from 0.15.0 to 0.16.0 (#3418) by @dependabot
- chore(deps-dev): bump zod from 3.23.8 to 3.24.1 (#3419) by @dependabot
- chore(deps): bump @types/node from 22.10.1 to 22.10.2 (#3420) by @dependabot
- chore(deps): bump vscode/devcontainers/javascript-node from
d493ef0
to896bfba
in /.devcontainer (#3421) by @dependabot - chore(deps-dev): bump lint-staged from 15.2.10 to 15.2.11 (#3417) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3413) by @dependabot
- chore(deps-dev): bump the vitest group across 1 directory with 2 updates (#3394) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3412) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 2 updates (#3395) by @dependabot
- chore: add @middy/core v6 as peer dependency (#3368) by @anthony-nhs
- chore(deps): bump @types/aws-lambda from 8.10.145 to 8.10.146 (#3370) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3381) by @dependabot
- chore(deps): bump @types/node from 22.10.0 to 22.10.1 (#3384) by @dependabot
- chore(deps-dev): bump the vitest group across 1 directory with 2 updates (#3383) by @dependabot
- chore: remove jest from codebase (#3379) by @dreamorosi
- chore: move RFCs to discussions (#3373) by @dreamorosi
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3357) by @dependabot
- chore(deps): bump @types/node from 22.9.0 to 22.10.0 (#3365) by @dependabot
- chore(deps-dev): bump husky from 9.1.6 to 9.1.7 (#3360) by @dependabot
- test(metrics): migrate tests to vitest & refactor (#3355) by @dreamorosi
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 4 updates (#3349) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3348) by @dependabot
- chore(deps-dev): bump typedoc-plugin-missing-exports from 3.0.0 to 3.0.2 in the typedoc group across 1 directory (#3342) by @dependabot
- feat(parser): Add appsync resolver event Zod schemas (#3301) by @svozza
- chore(deps-dev): bump markdownlint-cli2 from 0.14.0 to 0.15.0 (#3307) by @dependabot
- chore(maintenance): remove Gitpod-specific configs (#3347) by @dreamorosi
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3343) by @dependabot
This release was made possible by the following contributors:
@am29d, @anthony-nhs, @dependabot, @dependabot[bot], @dreamorosi, @github-actions, @github-actions[bot], @having-fun-serverless, @jharlow, @svozza and @zirkelc
v2.11.0
Summary
In this release we’ve added support for the new Node.js 22 managed runtime in AWS Lambda 🚀.
We have also added two new features to Metrics to let you: 1/ set a custom logger, and 2/ emit metrics with a custom timestamp; and improved Batch Processing by adding async processing of SQS FIFO queues.
⭐️ Thanks to @arnabrahman and @psperber for their contributions to this release!
Node.js 22 support
You can now use Powertools for AWS Lambda (TypeScript) with the new Node.js 22 runtime in AWS Lambda.
We’ve partnered with the AWS Lambda team for this launch and have been testing our toolkit for the past few weeks to ensure compatibility with no changes from your side.
To start using Powertools for AWS with the new runtime, you can upgrade to this version via npm or use the latest version of our Lambda layer.
Custom timestamps in metrics
You can now configure the timestamp of all the metrics you create, using the setTimestamp()
method. This allows you to specify a Datetime object or an integer representing an epoch timestamp in milliseconds. This is useful when emitting metrics related to an event in the past or in the future.
Bring your own logger to Metrics
Additionally, you can now also set a custom logger that the Metrics utility will use to emit warnings and debug logs. This is helpful for when you want to silence certain warnings or see diagnostic messages from the utility. To avoid compatibility issues and potential data loss, we will continue to emit the EMF blobs for your metrics directly to stdout.
FIFO queues async processing
You can now use an asynchronous function as record handler when processing a batch of items coming from an Amazon SQS FIFO queue. This is helpful when you need to perform side effects that involve http requests or other AWS services.
Changes
- chore(deps): bump github/codeql-action from 3.27.0 to 3.27.3 (#3314) by @dependabot
- chore(parser): fix type inference for result types (#3293) by @am29d
- chore: fix relative import regression (#3287) by @dreamorosi
- chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.15 to 3.0.16 (#3282) by @dependabot
- chore(deps): bump actions/setup-node from 4.0.4 to 4.1.0 (#3258) by @dependabot
- chore(deps): bump actions/dependency-review-action from 4.3.5 to 4.4.0 (#3268) by @dependabot
- chore(deps): bump github/codeql-action from 3.26.13 to 3.27.0 (#3245) by @dependabot
- chore(deps): bump actions/checkout from 4.2.1 to 4.2.2 (#3253) by @dependabot
- chore(deps): bump actions/setup-python from 5.2.0 to 5.3.0 (#3259) by @dependabot
- chore(deps): bump actions/dependency-review-action from 4.3.4 to 4.3.5 (#3235) by @dependabot
- chore(maintenance): add force-publish to bump all packages (#3238) by @am29d
🌟New features and non-breaking changes
- feat(batch): Async Processing of Records for for SQS Fifo (#3160) by @arnabrahman
- feat(metrics): add ability to pass custom logger (#3057) by @dreamorosi
🌟 Minor Changes
- improv(parser): export API Gateway v2 request schemas (#3271) by @dreamorosi
📜 Documentation updates
- chore: migrate dev environment to nodejs22 (#3327) by @dreamorosi
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3335) by @dependabot
- chore(deps): bump mkdocs-material from 9.5.44 to 9.5.45 in /docs (#3334) by @dependabot
- feat(metrics): ability to set custom timestamp with
setTimestamp
for metrics (#3310) by @arnabrahman - chore(deps): bump the aws-sdk-v3 group across 1 directory with 3 updates (#3312) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3297) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3300) by @dependabot
- feat(batch): Async Processing of Records for for SQS Fifo (#3160) by @arnabrahman
- chore(deps): bump @types/node from 22.8.4 to 22.9.0 (#3290) by @dependabot
- chore(deps): bump squidfunk/mkdocs-material from
2c2802b
toce587cb
in /docs (#3294) by @dependabot - chore(deps): bump mkdocs-material from 9.5.43 to 9.5.44 in /docs (#3295) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3280) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3277) by @dependabot
- chore(deps): bump squidfunk/mkdocs-material from
31eb7f7
to2c2802b
in /docs (#3276) by @dependabot - chore(deps): bump mkdocs-material from 9.5.41 to 9.5.43 in /docs (#3274) by @dependabot
- chore(deps-dev): bump tsx from 4.19.1 to 4.19.2 (#3275) by @dependabot
- chore(deps): bump @types/node from 22.7.7 to 22.8.4 (#3272) by @dependabot
- chore(docs): fix typo in captureHTTPsRequests (#3143) by @psperber
🐛 Bug and hot fixes
- fix(metrics): skip empty string dimension values (#3319) by @arnabrahman
- fix(parser): event type literal for selfManagedKafka (#3325) by @am29d
- fix(parser): add aws region to kinesis event (#3260) by @am29d
- fix(parser): fix cause errors nested structure (#3250) by @am29d
🔧 Maintenance
- chore: migrate dev environment to nodejs22 (#3327) by @dreamorosi
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3335) by @dependabot
- chore(deps): bump cross-spawn from 7.0.3 to 7.0.6 (#3331) by @dependabot
- chore(deps-dev): bump @vitest/coverage-v8 from 2.1.4 to 2.1.5 (#3318) by @dependabot
- fix(parser): event type literal for selfManagedKafka (#3325) by @am29d
- chore(deps): bump aws-xray-sdk-core from 3.10.1 to 3.10.2 (#3313) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 3 updates (#3312) by @dependabot
- test(parameters): migrate tests to vitest (#3304) by @dreamorosi
- chore(deps-dev): bump aws-sdk from 2.1691.0 to 2.1692.0 (#3298) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3297) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3300) by @dependabot
- test(parser): migrate to vitest (#3299) by @dreamorosi
- chore(deps-dev): bump @vitest/coverage-v8 from 2.1.3 to 2.1.4 (#3289) by @dependabot
- chore(deps): bump @types/node from 22.8.4 to 22.9.0 (#3290) by @dependabot
- test(maintenance): switch layers to vitest (#3292) by @dreamorosi
- chore(deps-dev): bump typedoc from 0.26.10 to 0.26.11 in the typedoc group across 1 directory (#3281) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3280) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3277) by @dependabot
- test(maintenance): switch tracer to vitest (#3285) by @dreamorosi
- chore(deps-dev): bump @types/jest from 29.5.13 to 29.5.14 (#3244) by @dependabot
- chore(deps-dev): bump tsx from 4.19.1 to 4.19.2 (#3275) by @dependabot
- chore(deps): bump @types/node from 22.7.7 to 22.8.4 (#3272) by @dependabot
- chore(maintenance): exclude e2e tests from pre-push hook (#3240) by @dreamorosi
This release was made possible by the following contributors:
@am29d, @arnabrahman, @dependabot, @dependabot[bot], @dreamorosi, @github-actions, @github-actions[bot] and @psperber
v2.10.0
Summary
This release improves the Logger utility by extending the formatting of errors to include custom properties.
⭐️ Thanks to @kevinpeno, and @ralbertazzi for their contributions to this release!
Log error properties
you more context over the nature of errors.
For example, consider these two custom error classes:
When calling logger.error('An error occurred', new SuperCustomError('foo', 42)); the log now looks like this:
Changes
- chore(maintenance): add force-publish to bump all packages (#3238) by @am29d
- chore(ci): add input type to the publish package workflow (#3236) by @am29d
- chore(ci): add workflow to publish a single package (#3234) by @am29d
- chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.14 to 3.0.15 (#3223) by @dependabot
- chore(deps): bump github/codeql-action from 3.26.12 to 3.26.13 (#3202) by @dependabot
- chore(deps): bump actions/upload-artifact from 4.4.2 to 4.4.3 (#3187) by @dependabot
- chore(deps): bump actions/upload-artifact from 4.4.0 to 4.4.2 (#3176) by @dependabot
- chore(deps): bump github/codeql-action from 3.26.11 to 3.26.12 (#3174) by @dependabot
- chore(deps): bump actions/checkout from 4.2.0 to 4.2.1 (#3175) by @dependabot
- chore(layers): remove schema parsing from layer canary (#3171) by @dreamorosi
🌟New features and non-breaking changes
- feat: add resetKeys to LoggerInterface type (#3213) by @ralbertazzi
- feat(logger): include enumerable properties in formatted errors (#3195) by @dreamorosi
📜 Documentation updates
- chore(deps): bump squidfunk/mkdocs-material from
0d4e687
to31eb7f7
in /docs (#3224) by @dependabot - chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3220) by @dependabot
- chore(deps): bump @types/node from 22.7.6 to 22.7.7 (#3221) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 5 updates (#3218) by @dependabot
- chore(deps): bump constructs from 10.3.0 to 10.4.2 (#3205) by @dependabot
- chore(deps): bump @types/node from 22.7.5 to 22.7.6 (#3216) by @dependabot
- chore(deps): bump squidfunk/mkdocs-material from
f9cb76d
to0d4e687
in /docs (#3211) by @dependabot - chore(deps): bump mkdocs-material from 9.5.40 to 9.5.41 in /docs (#3210) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3203) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3198) by @dependabot
- chore(deps): bump mkdocs-material from 9.5.38 to 9.5.40 in /docs (#3186) by @dependabot
- chore(deps): bump squidfunk/mkdocs-material from
7aea359
tof9cb76d
in /docs (#3185) by @dependabot - chore(deps): bump typescript from 5.6.2 to 5.6.3 (#3181) by @dependabot
- chore(deps): bump @types/node from 22.7.4 to 22.7.5 (#3180) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3192) by @dependabot
- docs(maintenance): add community content (#3190) by @dreamorosi
- docs(metrics): clarify single metrics metadata & publish (#3189) by @dreamorosi
- docs: fix env variable name in
logEventIfEnabled()
docstring (#3197) by @kevinpeno - chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3167) by @dependabot
🔧 Maintenance
- chore(maintenance): exclude e2e tests from pre-push hook (#3240) by @dreamorosi
- chore(parser): bump parser to 2.10.0 (#3230) by @am29d
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3220) by @dependabot
- chore(deps): bump @types/node from 22.7.6 to 22.7.7 (#3221) by @dependabot
- chore(deps): bump vscode/devcontainers/javascript-node from
61c3428
tod493ef0
in /.devcontainer (#3214) by @dependabot - chore(deps): bump the aws-sdk-v3 group across 1 directory with 5 updates (#3218) by @dependabot
- chore(deps-dev): bump @biomejs/biome from 1.9.3 to 1.9.4 (#3219) by @dependabot
- chore(deps-dev): bump @vitest/coverage-v8 from 2.1.2 to 2.1.3 (#3206) by @dependabot
- chore(deps): bump constructs from 10.3.0 to 10.4.2 (#3205) by @dependabot
- chore(deps-dev): bump aws-sdk-client-mock-vitest from 4.0.0 to 4.0.1 (#3215) by @dependabot
- chore(deps): bump @types/node from 22.7.5 to 22.7.6 (#3216) by @dependabot
- chore(deps-dev): bump the aws-sdk-v3 group across 1 directory with 2 updates (#3207) by @dependabot
- chore(deps-dev): bump typedoc from 0.26.8 to 0.26.10 in the typedoc group across 1 directory (#3209) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3203) by @dependabot
- chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3198) by @dependabot
- chore(deps): bump typescript from 5.6.2 to 5.6.3 (#3181) by @dependabot
- chore(deps): bump @types/node from 22.7.4 to 22.7.5 (#3180) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3192) by @dependabot
- chore(deps-dev): bump @biomejs/biome from 1.9.0 to 1.9.3 (#3177) by @dependabot
- chore(deps-dev): bump typedoc from 0.26.7 to 0.26.8 in the typedoc group across 1 directory (#3166) by @dependabot
- chore(deps): bump vscode/devcontainers/javascript-node from
426f06d
to61c3428
in /.devcontainer (#3141) by @dependabot - chore(deps-dev): bump @vitest/coverage-v8 from 2.1.1 to 2.1.2 (#3152) by @dependabot
- chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3167) by @dependabot
- chore(deps-dev): bump aws-cdk from 1.155.0 to 1.161.0 in layers (#3169) by @dreamorosi
This release was made possible by the following contributors:
@am29d, @dreamorosi, @kevinpeno, and @ralbertazzi