Skip to content

Releases: aws-powertools/powertools-lambda-typescript

v2.16.0

07 Mar 11:52
540a14b
Compare
Choose a tag to compare

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

Docs

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, and TRACE levels
  • Automatically flush logs on error or manually as needed
  • Reduce CloudWatch costs by decreasing the number of emitted log messages

carbon-8

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.

carbon-7

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

Docs

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

Docs

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

🌟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

📜 Documentation updates

🐛 Bug and hot fixes

#...

Read more

v2.15.0

25 Feb 09:15
e85ef33
Compare
Choose a tag to compare

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

Docs

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.

carbon-7

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

🌟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

🐛 Bug and hot fixes

🔧 Maintenance

This release was made possible by the following contributors:

@ConnorKirk, @VatsalGoel3, @am29d, @dreamorosi, @hjgraca, @shdq, and @sthulb

v2.14.0

11 Feb 12:53
a40b326
Compare
Choose a tag to compare

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

Docs

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.

carbon-3

New AWS Transfer Family schema

Docs

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.

carbon-4

Prevent overwriting Logger standard keys

Docs

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.

carbon-5

Lambda layer SSM Parameter lookup

Docs

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

🌟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 and parse 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 to c62453b 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 to 7e841df 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 to 471695f 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

28 Jan 14:13
128e959
Compare
Choose a tag to compare

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

Docs

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.

carbon-2

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

🌟 Minor Changes

  • improv(parser): export APIGatewayEventRequestContextSchema (#3507) by @dreamorosi

📜 Documentation updates

  • chore(deps): bump squidfunk/mkdocs-material from ba73db5 to 41942f7 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

This release was made possible by the following contributors:

@am29d, @dependabot, @dependabot[bot], @dreamorosi, @github-actions, @github-actions[bot] and @svozza

v2.13.0

14 Jan 15:02
1aade41
Compare
Choose a tag to compare

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

Docs

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

Docs

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.

carbon

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

📜 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 to ba73db5 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

17 Dec 16:19
d5ec97b
Compare
Choose a tag to compare

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 to d485eb6 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 to d063d84 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

🔧 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 to 896bfba 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

20 Nov 18:21
961f527
Compare
Choose a tag to compare

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

Docs

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.

carbon-6

Bring your own logger to Metrics

Docs

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.

carbon-7

FIFO queues async processing

Docs

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.

carbon-8

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

🌟 Minor Changes

📜 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 to ce587cb 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 to 2c2802b 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

23 Oct 10:17
cded5ec
Compare
Choose a tag to compare

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

Docs

you more context over the nature of errors.

For example, consider these two custom error classes:

carbon-21

When calling logger.error('An error occurred', new SuperCustomError('foo', 42)); the log now looks like this:

carbon-20

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

📜 Documentation updates

  • chore(deps): bump squidfunk/mkdocs-material from 0d4e687 to 31eb7f7 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 to 0d4e687 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 to f9cb76d 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 to d493ef0 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 to 61c3428 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

v2.9.0

08 Oct 13:31
71e70f5
Compare
Choose a tag to compare

Summary

This release introduces 1/ the ability to process records sequentially when working with async functions in Batch Processing, 2/ a new option for Idempotency to manipulate the payload stored for idempotent operations, and 3/ the option to specify custom JMESPath functions when selecting an idempotency key.

Finally, you can now use the Parser utility when using our public AWS Lambda layers.

⭐️ Thanks to @arnabrahman, @garysassano and, @scratchclaggy for their big contributions to this release!

Sequential async processing

Docs

You can now process records sequentially when working with async functions in Batch Processing by setting the processInParallel option to false. This is useful for when you want to opt-out of the default behavior and preserve the order of the records.

carbon-4

Manipulating idempotent responses

Docs

Now you can set up a responseHook function when configuring the Idempotency utility to manipulate the returned data when an operation is idempotent.

carbon-3

Custom JMESPath functions with Idempotency

Docs

You can now use custom JMESPath functions with the Idempotency utility by configuring the jmesPathOptions in your idempotency configuration. This is useful when you’re making idempotent operations that accept complex payloads or encoding formats that are not supported by default.

carbon-4

Changes

  • chore(layers): remove schema parsing from layer canary (#3171) by @dreamorosi
  • chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.12 to 3.0.14 (#3162) by @dependabot
  • chore(deps): bump github/codeql-action from 3.26.9 to 3.26.11 (#3157) by @dependabot
  • chore(deps): bump actions/checkout from 4.1.7 to 4.2.0 (#3122) by @dependabot
  • chore(deps): bump github/codeql-action from 3.26.8 to 3.26.9 (#3114) by @dependabot
  • chore(deps): bump actions/setup-node from 4.0.3 to 4.0.4 (#3097) by @dependabot
  • chore(layers): add Parser to layer (#3101) by @scratchclaggy
  • chore(deps): bump github/codeql-action from 3.26.7 to 3.26.8 (#3087) by @dependabot

🌟New features and non-breaking changes

  • feat(idempotency): ability to specify JMESPath custom functions (#3150) by @arnabrahman
  • feat(batch): sequential async processing of records for BatchProcessor (#3109) by @arnabrahman
  • feat(idempotency): manipulate idempotent response via response hook (#3071) by @arnabrahman

🌟 Minor Changes

  • refactor(logger): use LogLevelThreshold constant inside Logger class (#3133) by @arnabrahman

📜 Documentation updates

  • chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3163) by @dependabot
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3156) by @dependabot
  • chore(maintenance): add Flyweight customer reference (#3161) by @dreamorosi
  • docs(parser): highlight JSONStringify helper (#3158) by @dreamorosi
  • feat(idempotency): ability to specify JMESPath custom functions (#3150) by @arnabrahman
  • chore(deps): bump @types/node from 22.7.2 to 22.7.4 (#3139) by @dependabot
  • feat(batch): sequential async processing of records for BatchProcessor (#3109) by @arnabrahman
  • chore(deps): bump mkdocs-material from 9.5.36 to 9.5.38 in /docs (#3121) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 22a429f to 7aea359 in /docs (#3120) by @dependabot
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3116) by @dependabot
  • chore(docs): recreate requirements.txt file for mkdocs container (#3119) by @leandrodamascena
  • chore(deps): bump squidfunk/mkdocs-material from 2a70399 to 22a429f in /docs (#3104) by @dependabot
  • chore(deps): bump mkdocs-material from 9.5.35 to 9.5.36 in /docs (#3105) by @dependabot
  • chore(deps): bump @types/node from 22.5.5 to 22.7.2 (#3115) by @dependabot
  • chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3110) by @dependabot
  • chore(deps): bump esbuild from 0.23.1 to 0.24.0 (#3102) by @dependabot
  • docs(idempotency): fix descriptions in Advanced table (#3092) by @garysassano
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 6 updates (#3107) by @dependabot
  • chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3088) by @dependabot
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3090) by @dependabot
  • feat(idempotency): manipulate idempotent response via response hook (#3071) by @arnabrahman
  • chore(deps): bump squidfunk/mkdocs-material from a2e3a31 to 2a70399 in /docs (#3082) by @dependabot
  • chore(deps): bump mkdocs-material from 9.5.34 to 9.5.35 in /docs (#3084) by @dependabot
  • chore(deps): bump @types/node from 22.5.4 to 22.5.5 (#3067) by @dependabot

🔧 Maintenance

  • chore(deps-dev): bump aws-cdk from 1.155.0 to 1.161.0 in layers (#3169) by @dreamorosi
  • chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3163) by @dependabot
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3156) by @dependabot
  • chore(maintenance): add Flyweight customer reference (#3161) by @dreamorosi
  • chore(metrics): expose MetricsInterface as return type of single metric and further improve API docs (#3145) by @dreamorosi
  • test(idempotency): switch e2e tests to vitest (#3149) by @dreamorosi
  • test(logger): switch e2e tests to vitest (#3148) by @dreamorosi
  • chore(deps): bump @types/node from 22.7.2 to 22.7.4 (#3139) by @dependabot
  • chore(deps): bump @aws-sdk/client-lambda from 3.658.1 to 3.659.0 in the aws-sdk-v3 group across 1 directory (#3127) by @dependabot
  • test(logger): migrate to vitest & custom matchers (#3131) by @dreamorosi
  • test(event-handler): migrate to vitest (#3126) by @dreamorosi
  • test(idempotency): migrate to vitest (#3124) by @dreamorosi
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3116) by @dependabot
  • chore(deps): bump @types/node from 22.5.5 to 22.7.2 (#3115) by @dependabot
  • chore(deps): bump aws-xray-sdk-core from 3.10.0 to 3.10.1 (#3095) by @dependabot
  • chore(deps): bump @aws-cdk/cli-lib-alpha to 2.160.0-alpha.0 (#3118) by @dreamorosi
  • chore(deps-dev): bump @faker-js/faker from 9.0.1 to 9.0.2 (#3113) by @dependabot
  • chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3110) by @dependabot
  • chore(deps): bump esbuild from 0.23.1 to 0.24.0 (#3102) by @dependabot
  • chore(deps): bump vscode/devcontainers/javascript-node from b303046 to 426f06d in /.devcontainer (#3108) by @dependabot
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 6 updates (#3107) by @dependabot
  • chore(deps): bump rollup from 4.21.3 to 4.22.4 (#3106) by @dependabot
  • chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3088) by @dependabot
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3090) by @dependabot
  • chore(deps-dev): bump @faker-js/faker from 9.0.0 to 9.0.1 (#3075) by @dependabot
  • chore(deps): bump vite from 5.4.5 to 5.4.6 (#3081) by @dependabot
  • chore(deps): bump vscode/devcontainers/javascript-node from f1e8fdc to b303046 in /.devcontainer (#3080) by @dependabot
  • test(jmespath): switch tests to vitest (#3079) by @dreamorosi
  • test(commons): migrate to vitest (#3060) by @dreamorosi
  • chore(deps-dev): bump @vitest/coverage-v8 from 2.1.0 to 2.1.1 (#3068) by @dependabot
  • chore(deps): bump @types/node from 22.5.4 to 22.5.5 (#3067) by @dependabot

This release was made possible by the following contributors:

@arnabrahman, @dependabot, @dependabot[bot], @dreamorosi, @garysassano, @github-actions, @github-actions[bot], @leandrodamascena and @scratchclaggy

v2.8.0

16 Sep 12:37
af831b8
Compare
Choose a tag to compare

Summary

This release introduces 1/ the ability store parameters on AWS System Manager Parameter Store using the Parameters utility, and 2/ a new option for Logger that you can use to specify the order of how keys appear in your JSON-structured logs.

We are also adding a new TRACE log level to align with AWS Lambda Advanced Logging Controls (ALC), and improved made improvements to errors in the Idempotency utility, which now include more details on the cause of the error.

Finally, you can now use our public AWS Lambda Layers in two new AWS Regions: ap-south-2 and me-central-1.

⭐️ Thanks to @daschaa, @arnabrahman, and @timo92 for their contributions to this release!

Store parameters using SSM

Docs

In response to customer requests, you can now store parameters using AWS System Manager Parameter Store with the setParameter function. This new helper function fits right in with the other Parameters features you know and love, and provides a seamless experience without having to deal with the AWS SDK.

carbon-3

A big thank you to @daschaa for working on this feature!

Specify log keys order

Docs

You can now change the order of the keys in your logs via the logRecordOrder constructor parameter when using Logger. This is useful when you want to customize how the logs are structured without having to create and maintain your own custom log formatter.

carbon-4

When you specify one or more keys in the logRecordOrder we’ll place these keys first, followed by all the other keys in the log.

Thank you to @arnabrahman for adding this feature!

v1.x Reached End-of-Life (EOL)

Starting from September 1st 2024, v1.x of Powertools for AWS Lambda (TypeScript) has reached EOL and will not receive any further updates in accordance with our Versioning Policy.

We recommend you to upgrade to v2.x as soon as possible to continue receiving new feature and bug fixes. If you are having issues migrating and need support, please reach out via one of our channels or open a discussion on our repo.

Changes

  • chore(deps): bump github/codeql-action from 3.26.6 to 3.26.7 (#3064) by @dependabot
  • chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.11 to 3.0.12 (#3034) by @dependabot
  • chore(maintenance): switch to unmanaged log group for functions (#3014) by @dreamorosi
  • chore(maintenance): remove obsolete workflow (#3016) by @dreamorosi
  • chore(deps): bump actions/upload-artifact from 4.3.6 to 4.4.0 (#3006) by @dependabot
  • chore(deps): bump actions/setup-python from 5.1.1 to 5.2.0 (#3001) by @dependabot
  • chore(deps): bump github/codeql-action from 3.26.5 to 3.26.6 (#2996) by @dependabot
  • docs(parameters): review API docs & README for Parameters (#2994) by @am29d
  • chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.10 to 3.0.11 (#2979) by @dependabot
  • chore(deps): bump github/codeql-action from 3.26.4 to 3.26.5 (#2978) by @dependabot
  • chore(deps): bump github/codeql-action from 3.26.2 to 3.26.4 (#2968) by @dependabot
  • chore(deps): bump github/codeql-action from 3.26.1 to 3.26.2 (#2932) by @dependabot
  • test(logger): simplify unit tests structure (#2942) by @dreamorosi
  • chore(deps): bump github/codeql-action from 3.26.0 to 3.26.1 (#2925) by @dependabot
  • test(idempotency): simplify wrapper & middleware tests (#2919) by @dreamorosi
  • chore(deps): bump actions/upload-artifact from 4.3.4 to 4.3.6 (#2895) by @dependabot
  • chore(deps): bump github/codeql-action from 3.25.15 to 3.26.0 (#2894) by @dependabot

🌟New features and non-breaking changes

  • feat(parameters): adds setParameter function to store SSM parameters (#3020) by @daschaa
  • feat(logger): introduce log key reordering functionality (#2736) by @arnabrahman
  • feat(logger): introduce loglevel trace #1589 (#2902) by @timo92

🌟 Minor Changes

📜 Documentation updates

  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3066) by @dependabot
  • chore(deps-dev): bump tsx from 4.19.0 to 4.19.1 (#3062) by @dependabot
  • chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3049) by @dependabot
  • docs(tracer): clarify escape hatch mechanism (#3056) by @dreamorosi
  • docs(idempotency): add callout about undefined early return (#3055) by @dreamorosi
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3048) by @dependabot
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3045) by @dependabot
  • feat(parameters): adds setParameter function to store SSM parameters (#3020) by @daschaa
  • chore(docs): fix spelling issues (#3039) by @dreamorosi
  • chore(deps): bump typescript from 5.5.4 to 5.6.2 (#3041) by @dependabot
  • chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#3038) by @dependabot
  • chore(deps): bump @types/node from 22.5.2 to 22.5.4 (#3026) by @dependabot
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#3036) by @dependabot
  • feat(logger): introduce log key reordering functionality (#2736) by @arnabrahman
  • docs(maintenance): fix install instructions & switch test runner (#3030) by @dreamorosi
  • docs(maintenance): mark 1.x as EoL on docs (#3019) by @dreamorosi
  • chore(deps): bump mkdocs-material from 9.5.33 to 9.5.34 in /docs (#3005) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 7132ca3 to a2e3a31 in /docs (#3004) by @dependabot
  • chore(deps): bump @types/node from 22.5.1 to 22.5.2 (#3008) by @dependabot
  • chore(deps): bump aws-cdk from 2.145.0 to 2.155.0 in the aws-cdk group across 1 directory (#3007) by @dependabot
  • chore(deps): bump @types/node from 22.5.0 to 22.5.1 (#2998) by @dependabot
  • chore(deps): bump aws-cdk from 2.145.0 to 2.148.1 (#3003) by @dependabot
  • chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#2999) by @dependabot
  • docs: removed unnecessary exports previously added to api docs (#3000) by @am29d
  • chore(deps): bump ts-jest from 29.2.4 to 29.2.5 (#2981) by @dependabot
  • chore(deps-dev): bump tsx from 4.17.0 to 4.19.0 (#2986) by @dependabot
  • chore(deps): bump @types/aws-lambda from 8.10.143 to 8.10.145 (#2991) by @dependabot
  • chore(deps): bump aws-cdk from 2.145.0 to 2.148.1 (#2988) by @dependabot
  • chore(docs): load self hosted mermaid.js (#2977) by @dreamorosi
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#2973) by @dependabot
  • chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#2972) by @dependabot
  • chore(deps): bump @types/node from 22.4.1 to 22.5.0 (#2966) by @dependabot
  • chore(deps): bump mkdocs-material from 9.5.32 to 9.5.33 in /docs (#2971) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from a73e4bb to 7132ca3 in /docs (#2974) by @dependabot
  • chore(deps): bump esbuild from 0.23.0 to 0.23.1 (#2950) by @dependabot
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#2962) by @dependabot
  • chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#2958) by @dependabot
  • chore(deps): bump mkdocs-material from 9.5.31 to 9.5.32 in /docs (#2953) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 9919d6e to a73e4bb in /docs (#2952) by @dependabot
  • chore(deps): bump @types/node from 22.3.0 to 22.4.1 (#2951) by @dependabot
  • chore(deps): bump the aws-cdk group across 1 directory with 2 updates (#2931) by @dependabot
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#2941) by @dependabot
  • chore(deps): bump @types/node from 22.2.0 to 22.3.0 (#2926) by @dependabot
  • docs(logger): add logEventIfEnabled() docs (#2924) by @dreamorosi
  • chore(layers): deploy Lambda layers in ap-south-2 and me-central-1 (#2933) by @dreamorosi
  • feat(logger): introduce loglevel trace #1589 (#2902) by @timo92
  • chore(deps): bump @types/node from 22.1.0 to 22.2.0 (#2914) by @dependabot
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#2922) by @dependabot
  • docs(idempotency): review API docs & README (#2917) by @am29d
  • chore(maintenance): replace copy command in docs dockerfile (#2911) by @dreamorosi
  • chore(deps): bump @types/aws-lambda from 8.10.142 to 8.10.143 (#2896) by @dependabot
  • chore(deps): bump the aws-sdk-v3 group across 1 directory with 9 updates (#2888) by @dependabot
  • chore(deps-dev): bump tsx from 4.16.5 to 4.17.0 (#2907) by @dependabot

🐛 Bug and hot fixes

  • fix(tracer): include request pathname in trace data (#2955) by @dreamorosi
  • fix...
Read more