You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
Bug description
If using the decorator on handler and any execution flow endup throwing an exception, the metrics won't be flushed.
Expected Behavior
Metrics should be flushed whatever is happening in the customer code.
Current Behavior
If exception thrown, no metrics sent to cloudwatch.
Possible Solution
Option 1: Flush in a finally statement here: https://github.com/awslabs/aws-lambda-powertools-typescript/blob/main/packages/metrics/src/Metrics.ts#L93
Option 2: Leverage official lib https://github.com/awslabs/aws-embedded-metrics-node that handle this properly
Steps to Reproduce
Add this test to unit tests:
Should pass after fix
Environment
Related issues, RFCs
N/A
The text was updated successfully, but these errors were encountered: