Releases: aws-powertools/powertools-lambda-typescript
v1.6.0
Summary
This minor release fixes some bugs on the Logger as well as bringing some improvements on how log levels are accepted and handled. As a part of the release we have also published our public Lambda Layers to 3 new AWS Regions.
Logger
The first of two bugs addressed was affecting functions using Logger together with the injectLambdaContext Middy middleware. When enabling both the clearState and logEvent flags, attributes attached to logs within the function's scope were not cleared properly. This caused values set during an invocation to appear in the event log emitted at the beginning of the next invocation. We have fixed the bug and revisited our unit and integration tests to prevent future regressions.
The second bug was instead related to the createChild method and caused children of a Logger instance to not inherit all attributes of their parents. We have fixed the issue, improved our unit tests around the feature, and clarified the documentation.
Finally, we have made the types of the logLevel construct option of Logger more strict, so that typos in the log level names can be caught at compile time rather than fail silently at runtime.
Lambda Layers
You can now use our Lambda Layers in three new AWS Regions: Spain (eu-south-2), Zurich (eu-central-2), and Asia Pacific (Melbourne) (ap-southeast-4). Find the full list of regional ARNs here.
With this release we can finally consider the roadmap item related to this topic complete 🚀.
Acknowledgments
A big thanks also to @Muthuveerappanv for getting their first PR merged into the repo, as well as @shdq and @niko-achilles for the contributions around Logger and documentation.
Finally as you can see from the full list of changes below, the team has been hard at work to bring you new utilities, so keep an eye on the next releases!
Changes
- tests(logger): revisited integration tests (#1342) by @dreamorosi
- tests(logger): revisit Logger unit tests (#1339) by @dreamorosi
- tests(parameters): update package to run as part of e2e tests (#1318) by @dreamorosi
- tests(parameters): integration tests for
AppConfigProvider(#1287) by @dreamorosi - tests(parameters): integration tests for
SSMProvider(#1257) by @dreamorosi - tests(parameters): added missing tests for
DynamoDBProvider(#1285) by @dreamorosi - tests(parameters): add comments to
SecretsProvidere2e test (#1282) by @am29d - tests(parameters): integration tests for
SecretsProvider(#1263) by @am29d - build(deps): bump http-cache-semantics from 4.1.0 to 4.1.1 (#1270) by @dependabot
- tests(parameters): end to end tests for
DynamoDBProvider(#1244) by @dreamorosi
🌟New features and non-breaking changes
- feat(logger): make loglevel types stricter (#1313) by @dreamorosi
- feat(layers): add new regions (#1322) by @am29d
- refactor(parameters): moved ssm resource creation to
AwsCustomResource(#1319) by @dreamorosi - refactor(parameters): move table seeding into
AwsCustomResource(#1317) by @dreamorosi - feat(idempotency): Add function wrapper and decorator (#1262) by @KevenFuentes9
- feat(parameters): add support for custom AWS SDK v3 clients for providers (#1260) by @shdq
📜 Documentation updates
- docs(logger): update child logger docs section and snippets (#1286) by @shdq
- docs(examples): made SAM CLI version requirement more explicit (#1284) by @dreamorosi
- fix(docs): logger bringYourOwnFormatter snippet (#1254) by @niko-achilles
- docs(metrics): extract Metrics code snippets in separate files (#1245) by @niko-achilles
- docs: correct link to Powertools for Java (#1247) by @niko-achilles
- docs: remove Node.js 12 deprecation notice from docs (#1237) by @dreamorosi
- docs: update layer version to 7 (#1235) by @dreamorosi
🐛 Bug and hot fixes
- fix(logger): middleware stores initial persistent attributes correctly (#1329) by @dreamorosi
- fix(parameters): handle base64/binaries in transformer (#1326) by @dreamorosi
- fix(logger): fix a bug when child logger didn't get all the parent's attributes (#1267) by @shdq
- fix(docs): logger bringYourOwnFormatter snippet (#1254) by @niko-achilles
- fix(parameters): Tokenize attribute names in
DynamoDBProvider(#1239) by @dreamorosi
🔧 Maintenance
- chore: add disclaimer to PR template (#1351) by @dreamorosi
- chore(ci): fix typo in doc publishing workflow (#1349) by @dreamorosi
- chore: add workspace flag to
packagescript (#1344) by @Muthuveerappanv - chore(ci): narrow down stale issue filtering (#1346) by @dreamorosi
- chore(ci): revisit stale issues automation (#1341) by @dreamorosi
- chore(ci): pin 3rd party actions to sha commit (#1335) by @am29d
- chore: updated
homepagefield inpackage.jsonfiles (#1338) by @dreamorosi - chore: revisited issue & PR templates (#1336) by @dreamorosi
- chore(ci): fixed workflow dependencies (#1333) by @dreamorosi
- chore(ci): automatically update docs after layer publish during release (#1324) by @am29d
- chore(layers): fix workflow + linting/housekeeping (#1327) by @dreamorosi
- chore(layers): moved
layer-publisherinto npm workspace (#1292) by @dreamorosi - chore: remove unused extensions from Gitpod/CodeSpaces (#1312) by @niko-achilles
- chore(docs): update project's description (#1290) by @dreamorosi
- chore(docs): moved docs/snippets checks to separate step (#1274) by @dreamorosi
- chore: integrate parameters into CI/CD package measurement (#1266) by @am29d
- chore(tests): standardize env setup for tests (#1255) by @dreamorosi
- chore(docs): add
docs/snippetsto npm workspace (#1251) by @dreamorosi - chore(internal): add @middy/core license to proejct third-party licenses (#1249) by @dreamorosi
- chore(layers): bump hardcoded version in
reusable_deploy_layer_stack.yml(#1234) by @dreamorosi - chore(layers): bump hardcoded cdk version in
publish_layer.yaml(#1232) by @dreamorosi
This release was made possible by the following contributors:
@KevenFuentes9, @Muthuveerappanv, @am29d, @dreamorosi, @heitorlessa, @niko-achilles and @shdq
v1.5.1
Summary
This first release for 2023 updates the AWS Lambda runtimes officially supported by Powertools for TypeScript, as well as bug fixes.
Node.js 12 deprecation
With AWS Lambda deprecating the nodejs12.x runtime at the end of March this year, we have decided to drop support for the runtime as well. Node.js 12 has reached end-of-life a few months ago, so we recommend anyone still using this runtime to upgrade their functions to Node.js 14 or later.
Node.js 18 support
With one runtime going away, we now add support for the nodejs18.x runtime. In the past few weeks we have updated our CI workflows to continuously run unit and integration tests to include the new runtime. This has given us enough confidence to announce that the project is compatible with the runtime.
Bug fixes
Logger
This release adds support for BigInt to Logger. This type of objects cannot be natively serialized, so before to this release Logger would throw an error.
Now, if you try to log an object that contains a BigInt, Logger will automatically convert it to a string and log it for you:
import { Logger } from "@aws-lambda-powertools/logger";
const logger = new Logger();
logger.info('Object with bigint value', { myBigInt: BigInt(1234) })will result in:
{
"level": "INFO",
"message": "Object with bigint value",
"service": "service_undefined",
"timestamp": "2022-10-12T22:27:17.067Z",
"myBigInt": "1234"
}Thanks @shdq for the fix!
Bundling with tsc
Prior to this release, customers using tsc to bundle their functions but not using any of the Powertools middleware, were experiencing build-time errors due to one of our dependencies not being tree-shaken correctly. This release introduces a change to the internals of our packages that allow those customers to use tsc without having to install an extra devDependency only to please the compiler.
Acknowledgments
A big thank you to @shdq for the continuous generous contributions 🙏, and a congrats to @niko-achilles for landing your first batch of PR merged 🎉
Finally, while still not published on npm, there's a lot of work being done on the upcoming Idempotency and Parameters utilities that the team and community are doing. You can follow the progress in the respective milestones here and here.
Changes
- build(layers): aligned aws cdk versions in
layer-publisherto main workspace (#1228) by @dreamorosi - build(deps): bump json5 from 1.0.1 to 1.0.2 (#1212) by @dependabot
- build(deps): bump json5 from 1.0.1 to 1.0.2 in /layer-publisher (#1209) by @dependabot
- build(deps): bump json5 from 1.0.1 to 1.0.2 in /examples/sam (#1210) by @dependabot
- build(deps): bump json5 from 1.0.1 to 1.0.2 in /examples/cdk (#1211) by @dependabot
- build(deps): bump decode-uri-component from 0.2.0 to 0.2.2 (#1185) by @dependabot
🌟New features and non-breaking changes
- refactor(all): add middy-like types to commons (#1225) by @dreamorosi
- feat(parameters): DynamoDBProvider support (#1202) by @dreamorosi
- feat(parameters): AppConfigProvider (#1200) by @shdq
- feat(parameters): SSMProvider support (#1187) by @dreamorosi
- refactor(parameters): types in BaseProvider + added getMultiple alias to SecretsProvider (#1214) by @dreamorosi
- feat(parameters): SecretsProvider support (#1206) by @dreamorosi
- refactor(parameters): BaseProvider support for Uint8Array (#1205) by @dreamorosi
📜 Documentation updates
- docs: update layer version to 7 (#1235) by @dreamorosi
- docs(logger): extract Logger code snippets in separate files (#1230) by @niko-achilles
- docs(tracer): extract Tracer code snippets in separate files #1219 (#1229) by @niko-achilles
- docs(parameters): main docs for the utility (#1215) by @dreamorosi
- docs: update CDK example to nodejs18 (#1197) by @dreamorosi
- docs: update sam example to nodejs18 (#1196) by @dreamorosi
- docs: refresh SAM examples (#1180) by @bpauwels
- docs: added Node.js 12 deprecation banner to docs (#1188) by @dreamorosi
- docs: update layer version to 6 (#1184) by @dreamorosi
🐛 Bug and hot fixes
🔧 Maintenance
- chore(layers): bump hardcoded version in
reusable_deploy_layer_stack.yml(#1234) by @dreamorosi - chore(layers): bump hardcoded cdk version in
publish_layer.yaml(#1232) by @dreamorosi - chore(parameters): revisit utility types (#1223) by @dreamorosi
- chore(docs): bumped mkdocs-material to latest + small tweaks (#1217) by @dreamorosi
- chore(docs): update year in docs (#1208) by @dreamorosi
- chore: add Node.js 18 support (#1192) by @dreamorosi
- chore: remove httpbinorg request from integration tests (#1194) by @dreamorosi
- chore: end of support for nodejs12x runtime (#1190) by @dreamorosi
This release was made possible by the following contributors:
v1.5.0
Summary
This release includes some bug fixes and quality of life improvements on the Logger utility as well as improvements on the bundle size of our public Lambda Layers.
Logger
Prior to this release, when creating child loggers, Logger was affected by a bug that caused some of the settings to not be properly reflected in its children. This release corrects the issue by reworking the logic used to create child loggers.
Additionally, thanks to @shdq's contribution, those who use jest and Logger can now leverage the --silent flag to silence logs emitted by Logger in their unit tests.
Lambda Layer
Thanks to a report from @Muthuveerappanv, we were able to shave ~3MB from the deployment package of our public Lambda Layers by removing @types from the node_modules folder. This will give you back some valuable space when using the layers.
Upcoming Utilities
The release also includes unreleased work on two new upcoming utilities: Idempotency and Parameters. On both fronts we have finished laying the foundations for the utilities and we will now start gradually adding features. Stay tuned for more updates on this topic in the next releases.
Governance
As part of this release we have also published a new and improved GitHub Project that you can use to stay updated with the team's progress as well as finding contributing opportunities. We also have added a new "Roadmap" section to the docs, use this page to learn about the team's priorities for the upcoming months.
Acknowledgements
A big thank you to @shdq who has been a big part of this release, to @ConnorKirk for his first contribution to the project, and to @jeffrey-baker-vg and the rest of the team for the hard work on Idempotency.
Changes
- tests(idempotency): add utility to workspace unit tests and CI (#1160) by @dreamorosi
- feat(idempotency): Add persistence layer and DynamoDB implementation (#1110) by @jeffrey-baker-vg
- feat(logger): pretty printing logs in local and non-prod environment (#1141) by @shdq
🌟New features and non-breaking changes
- feat(parameters): added
BaseProviderclass (#1168) by @dreamorosi
🌟 Minor Changes
📜 Documentation updates
- docs: add maintainers and public roadmap (#1167) by @dreamorosi
- docs: update environment variable tables for utilities (#1153) by @ConnorKirk
- docs: clarify nodejs16 requirement + fix command (#1152) by @dreamorosi
🐛 Bug and hot fixes
🔧 Maintenance
- chore: add install step in docs workflow (#1183) by @dreamorosi
- chore(layer): reduce size by 3 by removing @types packages (#1181) by @flochaz
- chore(internal): remove unused test folder from project's root (#1162) by @dreamorosi
- chore: add codespaces badge (#1155) by @dreamorosi
- chore(docs): update layer version to 5 (#1150) by @dreamorosi
This release was made possible by the following contributors:
@ConnorKirk, @dreamorosi, @flochaz, @jeffrey-baker-vg and @shdq
v1.4.1
Summary
This patch release fixes a bug in Metrics as well as introducing some improvements in the documentation and jsdoc examples that accompany all public APIs of the utilities.
The bug in Metrics caused the service name to be cleared from the default dimensions after metrics were published or after the first function invocation when using the middleware or decorator. The service name is automatically added to metrics emitted by the utility and should always be present as dimension.
Finally, thank you to @niko-achilles for helping raise the bar on the documentation. Below an example of the jsdoc string rendered in VS Code:

Changes
📜 Documentation updates
- docs(all): update & revise docstring examples (#1144) by @dreamorosi
🐛 Bug and hot fixes
- fix(metrics): store service name in defaultDimensions to avoid clearing it (#1146) by @dreamorosi
🔧 Maintenance
- chore(docs): update layer version to 5 (#1150) by @dreamorosi
- chore(internal): update workflow reference (#1148) by @dreamorosi
- chore(all): removed unused npm scripts + moved linting in PR checks (#1125) by @dreamorosi
- chore(docs): update docs with newer layer version (#1137) by @dreamorosi
This release was made possible by the following contributors:
@dreamorosi and @github-actions[bot]
v1.4.0
Summary
This release introduces a new feature in Tracer that allows customers to access the AWS X-Ray Root Trace ID. The release also includes a bug fix for Metrics where an issue prevented dimensions and metadata to be cleared on metrics publish. Finally, it also includes some updates to the docs, one of which introduces an example of how to use the Powertools layer with Pulumi.
Tracer
The Tracer utility now has a new public method called getRootXrayTraceId() (docs). With this method you can access the root trace id and use it in your responses or downstream processing as correlation id.
Thank you @misterjoshua for suggesting the feature and helping review the PR.
Metrics
Prior to this release a bug in the Metrics utility prevented metadata and dimensions of metrics to leak between function executions. This was due to a faulty logic that didn't clear properly the two objects when metrics were published. Thanks to @shdq the bug has been fixed and unit tests around the behavior were added. Congrats @shdq for your first PR merged 🎉
Docs
Finally, thanks to @pierskarsenbarg's first contribution to this repo (💯) , the documentation now has an example of how to use the Powertools layer with Pulumi!
Changes
🌟New features and non-breaking changes
- feat(all): moved EnvService to commons + exposed getXrayTraceId in tracer (#1123) by @dreamorosi
📜 Documentation updates
- Added Pulumi code to deploy lambda with powertools (#1135) by @pierskarsenbarg
- docs: main page updates around support (#1133) by @dreamorosi
- docs(layers): fix format issues (#1122) by @dreamorosi
- docs: update layer version in docs (#1120) by @dreamorosi
🐛 Bug and hot fixes
🔧 Maintenance
- chore(governance): update issue templates to use forms (#1128) by @dreamorosi
This release was made possible by the following contributors:
v1.3.0
Summary
This release adds public AWS Lambda Layers, a new feature for Tracer, and bug fixes on all utilities.
AWS Lambda Layers
You can now use AWS Lambda Powertools for TypeScript by adding just a few lines to your configs and using our public AWS Lambda Layers.
Lambda Layer is a .zip file archive that can contain additional code, pre-packaged dependencies, data, or configuration files. Layers promote code sharing and separation of responsibilities so that you can iterate faster on writing business logic.
You can include Lambda Powertools Lambda Layer using AWS Lambda Console, or your preferred deployment framework. Lambda Layers also allow us to understand who uses this library in a non-intrusive way. This helps us justify and gain future investments for other Lambda Powertools languages.
When using AWS SAM or Serverless Framework:
With CDK:
New Features
Tracer
When using the captureMethod decorator on your class method you can now specify a custom name for the subsegment that Tracer generates for you.
You can do so by passing a newly added subSegmentName parameter to the decorator. This is useful for those cases in which the decorated method has an long or non-meaningful name but also in cases in which you want to nest method calls and represent this nesting in the segment names by using different levels of ###/####.
Bug Fixes
Metrics
The Metrics utility has two parameters captureColdStartMetric and throwOnEmptyMetrics that allow respectively to create a cold start metric for those invocations that had an initialization phase, and to throw an error before flushing metrics to ensure that at least one metric is emitted.
Prior to this release there was a bug that caused the parameters to be misinterpreted when passed to the logMetrics middleware. This release ensures that the parameters are parsed correctly and adds additional tests to verify and maintain the behavior.
Logger
The indectLambdaContext decorator allows you to enrich your structured logs with key Lambda context information. The appendKeys method instead allows you to append additional keys and values to logs while within the function handler's scope.
Prior to this release there was a bug that caused some of these additional keys and values to be cleared too soon due to the decorator not awaiting for the decorated method to return. This release fixes the issue and adds tests to prevent future regressions.
Tracer
The captureMethod decorator allows you to trace Class methods and create segments for its operations.
Prior to this release, when using captureMethod with certain 3rd party decorators the name of the decorated method was not detected correctly causing the segment name and its annotation to be mislabeled. This release changes the logic around name detection to ensure names are properly annotated.
Changes
- Chore(tracer): unit tests to verify decorators await decorated class methods (#1108) by @dreamorosi
- Fix: standardized and consistent linting strategy across Lerna targets (#1105) by @saragerion
🌟New features and non-breaking changes
- feat(tracer): specify subsegment name when capturing class method (#1092) by @dreamorosi
- feat: publish lib as Lambda Layer (#1095) by @flochaz
- feat(idempotency): create initial class structure for function idempotency (#1086) by @jeffrey-baker-vg
📜 Documentation updates
- docs: update layer version in docs (#1120) by @dreamorosi
- doc(layer): bump layer version to 2 to match the one built for latest version (1.2.1) (#1113) by @flochaz
🐛 Bug and hot fixes
- fix(all): update version command to use lint-fix (#1119) by @dreamorosi
- fix(tracer): captureMethod detects proper method name when used with external decorators (#1109) by @dreamorosi
- fix(metrics): captureColdStartMetric and throwOnEmptyMetrics when set to false was interpreted as true (#1090) by @flochaz
- fix(logger): wait for decorated method return before clearing out state (#1087) by @dreamorosi
- fix(build): remove leftover code in action that labels issues on merge (#1078) by @dreamorosi
🔧 Maintenance
- fix(all): update version command to use lint-fix (#1119) by @dreamorosi
- chore(layer): fix bundling and e2e tests by manually setting hash of asset (#1116) by @flochaz
- chore(build): fix ts-node version for layer-publisher (#1112) by @flochaz
- build(deps): bump vm2 from 3.9.9 to 3.9.11 (#1094) by @dependabot
- improv(build): allow to specify PR number when running e2e tests (#1079) by @dreamorosi
- fix(build): remove leftover code in action that labels issues on merge (#1078) by @dreamorosi
- chore(build): update make-release.yml to remove redundant publish step (#1075) by @dreamorosi
This release was made possible by the following contributors:
v1.2.1
Summary
We are thrilled to share that we have a new home on Discord!
We hope that this new chapter will allow us to connect and learn from each other, as well as shape together the feature of Powertools.
Join us here: https://discord.gg/B8zZKbbyET
Thanks @sthuber90 for opening the PR to update our docs and adding the new link.
Changes
📜 Documentation updates
- docs(home): add discord invitation link (#1074) by @sthuber90
This release was made possible by the following contributors:
v1.2.0
Summary
In this patch release we are updating the Metrics utility to support 3x more dimensions (up to 30) per metric, as well as adding a new way to suppress response capture to Tracer.
Metrics
A few weeks ago Amazon CloudWatch increased metric throughput. This release takes advantage of the new metric dimension to increase our validation limit to 30.
Thank you @sthuber90 for taking this feature and congrats for your first PR in this repo 🎉
Tracer
By default, when using the Tracer as a middleware or as a decorator, the utility captures the response returned by a method or Lambda handler and adds it as metadata on the current segment. This allows you to gain insights about the execution and the results in the context of your traces.
In some instances, for example if the response is too big (> 64 kB), or if it contains sensitive informations, you might want to disable this behavior.
With this release you can use the captureResponse: false option in both tracer.captureLambdaHandler() and tracer.captureMethod() decorators, or use the same option in the Middy captureLambdaHander middleware to instruct Tracer not to serialize function responses as metadata.
Once again, thank you @misterjoshua for proposing and implementing this behavior 🙌
🌟New features and non-breaking changes
- feat(metrics): increase maximum dimensions to 29 (#1072) by @sthuber90
- feat(tracer): allow disabling result capture for decorators and middleware (#1065) by @misterjoshua
🐛 Bug and hot fixes
- fix(docs): docs published with incorrect version number + api docs missing after release (#1066) by @dreamorosi
This release was made possible by the following contributors:
v1.1.1
Summary
This patch release addresses an issue with Lambda handlers written as a class and that uses the Powertools utilities to decorate some of its methods. The defect prevented class members from accessing the class instance and calling other methods or reading attributes.
Thanks to @misterjoshua, we have modified the implementation of the decorator and also improved our documentation to make sure that classes implementing LambdaInterface can work properly. To learn more, check out this issue that contains a more detailed explanation.
import { Tracer } from '@aws-lambda-powertools/tracer';
import { LambdaInterface } from '@aws-lambda-powertools/commons';
const tracer = new Tracer({ serviceName: 'serverlessAirline' });
class Lambda implements LambdaInterface {
@tracer.captureLambdaHandler()
public async handler(_event: any, _context: any): Promise<void> {
/* ... */
}
}
const handlerClass = new Lambda();
export const handler = handlerClass.handler.bind(handlerClass); // <- Binding your handler method allows your handler to access `this`.Finally, a big thank you to @misterjoshua who reported the bug, collaborated to the triaging, and submitted a PR proposing a fix 🎉
Changes
📜 Documentation updates
- chore(tracer): remove redundant export in docs & examples (#1062) by @dreamorosi
🐛 Bug and hot fixes
- Fix(metrics): decorated class methods cannot access
this(#1059) by @dreamorosi - fix(logger): decorated class methods cannot access
this(#1060) by @dreamorosi - fix(tracer): use instance as
thisin capture decorators (#1055) by @misterjoshua - fix(build): publish workflow concurrency + leftover dependencies (#1054) by @dreamorosi
🔧 Maintenance
- chore(tracer): remove redundant export in docs & examples (#1062) by @dreamorosi
This release was made possible by the following contributors:
v1.1.0
Summary
This release contains two bug fixes that were reported by community members:
Loggerwas affected by a bug that prevented it from correctly clearing the state of attached attributes when the Lambda handler was throwing an error.Tracerinstead had a bug incaptureMethodfeature that caused the scope of the decorated method to be wrongly reassigned.
Over the past weeks the team has also been working on improving and strengthening the security of the CI/CD pipelines that allow to run unit and integration tests, as well as publishing the packages on NPM and the documentation.
Additionally, it contains some initial groundwork that will allow us to publish the libraries as Lambda layers - so stay tuned for news on this topic in the coming weeks!
Finally, a big thank you also to first-time contributors: @tsop14 and @ratscrew 🎉 Thank you for helping improving the library!
Changes
🌟New features and non-breaking changes
📜 Documentation updates
🐛 Bug and hot fixes
- Fix(build): e2e workflow failing (#1047) by @dreamorosi
- fix(logger): fix clearstate bug when lambda handler throws (#1045) by @saragerion
- fix: wrong scope in captureMethod (#1026) by @ratscrew
🔧 Maintenance
- feat(build): publish lib as a Lambda Layer (#884) by @flochaz
- chore(build): broke up pr workflow & measure package size (#1031) by @dreamorosi
- chore(ci): housekeeping scripts & workflows related to PRs (#1023) by @dreamorosi






