v1.14.0
Summary
This release brings all the generally available utilities to the Lambda Layers, improves the Idempotency utility with the addition of a new @idempotent
class method decorator, and makes Tracer more reliable.
Lambda Layers
Starting from version 21, which corresponds to this release, of our Lambda Layer includes the Idempotency, Parameters, and Batch Processing utilities. The layer comes with its own reduced copy of AWS SDK v3 for JavaScript clients so you can easily attach it to Lambda functions running on Node.js 16 without having to bundle the SDK.
The layers are available in most commercial AWS Regions, go here to learn more about how to use them and find the ARN for your region.
Idempotency
If you use decorators you can now make your class methods idempotent thanks to the new @idempotent
decorator.
You can use the decorator on your Lambda handler, like shown in the image above, or on any method that returns a response. This is useful when you want to make a specific part of your code idempotent, for example when your Lambda handler performs multiple side effects and you only want to make part of it safe to retry.
Tracer
When segments generated by your code are about to be sent to the AWS X-Ray daemon, the AWS X-Ray SDK for Node.js serializes them into a JSON string. If the segment contains exotic objects like BigInt
, Set
, or Map
in the metadata the serialization can throw an error because the native JSON.stringify()
function doesn't know how to handle these objects.
To guard against this type of runtime errors we have wrapped within try/catch
logic the branches of code in Tracer where this issue could happen. Now, when an error gets thrown during the serialization of a segment within Tracer, we will catch it and log a warning instead.
We are also working with the X-Ray team to add a replacer
function to the serialization logic directly in the X-Ray SDK so that the issue can be better mitigated.
Acknowledgements
Congratulations to @HaaLeo and @KhurramJalil for having your first contribution to the project, thank you for helping make Powertools better for everyone 🎉
Note
We have officially started working on the next major version of Powertools for AWS (TypeScript) 🔥 We have published a Request For Comment (RFC) that details most of the changes that we have planned and in the coming weeks we'll work on an upgrade guide. We would love to hear what you think about our plan and hear any concern you might have.
Changes
- chore(ci): create v2 alpha release workflow (#1719) by @dreamorosi
- chore(layers): add Idempotency, Batch, and Parameters to layer (#1712) by @am29d
🌟New features and non-breaking changes
- feat(idempotency): add idempotency decorator (#1723) by @am29d
- feat(tracer): add try/catch logic to decorator and middleware close (#1716) by @dreamorosi
- feat(layers): add
arm64
to integration test matrix (#1720) by @dreamorosi
🌟 Minor Changes
- improv(commons): add number key type to JSONObject type (#1715) by @KhurramJalil
- refactor(commons): aws sdk util + identity check (#1708) by @dreamorosi
📜 Documentation updates
- docs(idempotency): address comments (#1724) by @am29d
- feat(idempotency): add idempotency decorator (#1723) by @am29d
- docs: typo for serverless framework (#1701) by @HaaLeo
🔧 Maintenance
- docs(idempotency): address comments (#1724) by @am29d
- feat(idempotency): add idempotency decorator (#1723) by @am29d
- chore(layers): bundle assets from source when testing (#1710) by @dreamorosi
- refactor(commons): aws sdk util + identity check (#1708) by @dreamorosi