Skip to content

Releases: aws-powertools/powertools-lambda-typescript

v1.5.0

25 Nov 10:54
Compare
Choose a tag to compare

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

🌟 Minor Changes

  • feat(logger): disable logs while testing with jest --silent in dev env (#1165) by @shdq

📜 Documentation updates

🐛 Bug and hot fixes

  • fix(logger): merge child logger options correctly (#1178) by @shdq

🔧 Maintenance

This release was made possible by the following contributors:

@ConnorKirk, @dreamorosi, @flochaz, @jeffrey-baker-vg and @shdq

v1.4.1

09 Nov 14:30
Compare
Choose a tag to compare

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:
image

Changes

📜 Documentation updates

🐛 Bug and hot fixes

  • fix(metrics): store service name in defaultDimensions to avoid clearing it (#1146) by @dreamorosi

🔧 Maintenance

This release was made possible by the following contributors:

@dreamorosi and @github-actions[bot]

v1.4.0

27 Oct 13:04
Compare
Choose a tag to compare

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.

carbon-2

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!

carbon

Changes

🌟New features and non-breaking changes

  • feat(all): moved EnvService to commons + exposed getXrayTraceId in tracer (#1123) by @dreamorosi

📜 Documentation updates

🐛 Bug and hot fixes

  • fix(metrics): metadata and dimensions not cleared on publish (#1129) by @shdq

🔧 Maintenance

This release was made possible by the following contributors:

@dreamorosi, @pierskarsenbarg and @shdq

v1.3.0

17 Oct 16:00
Compare
Choose a tag to compare

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:

carbon-6

With CDK:

carbon-7

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 ###/####.

carbon-5

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

📜 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:

@dreamorosi, @flochaz, @jeffrey-baker-vg and @saragerion

v1.2.1

25 Aug 08:06
Compare
Choose a tag to compare

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

This release was made possible by the following contributors:

@sthuber90

v1.2.0

23 Aug 15:24
Compare
Choose a tag to compare

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.

carbon

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:

@dreamorosi, @misterjoshua and @sthuber90

v1.1.1

18 Aug 14:45
Compare
Choose a tag to compare

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

🔧 Maintenance

  • chore(tracer): remove redundant export in docs & examples (#1062) by @dreamorosi

This release was made possible by the following contributors:

@dreamorosi and @misterjoshua

v1.1.0

12 Aug 12:15
Compare
Choose a tag to compare

Summary

This release contains two bug fixes that were reported by community members:

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

  • feat(build): publish lib as a Lambda Layer (#884) by @flochaz

📜 Documentation updates

🐛 Bug and hot fixes

🔧 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

This release was made possible by the following contributors:

@dreamorosi, @flochaz, @ratscrew, @saragerion and @tsop14

v1.0.2

19 Jul 14:49
Compare
Choose a tag to compare

Summary

This release introduces changes entirely related to our documentation and examples.

📚 Documentation improvements 📚

  • Clarified that people can use the library in both TypeScript and JavaScript code bases
  • Added references to the Serverless TypeScript Demo application
  • Added a single copy-paste-able command to install all three utilities at once
  • Added Call to Actions to contribute and help us drive our roadmap
  • Improved consistency with the messaging of the Launch blog post
  • Changed font size and removed the Table of Contents on the right side to improve readability in smaller screens
  • Improved UX when zooming in and scrolling through images
  • Added images in Logger, Tracer and Metrics to showcase outputs in CloudWatch (with ALT)
  • Changed order of examples to: Middy, Decorator, Manual instrumentation
  • Added license link

📚 Examples 📚

Examples in the repository have been updated to use version 1.x 🚀

Changes

📜 Documentation updates

🔧 Maintenance

This release was made possible by the following contributors:

@dreamorosi, @github-actions[bot] and @saragerion

v.1.0.1

19 Jul 14:50
Compare
Choose a tag to compare

Note: Version bump for all packages.