-
Notifications
You must be signed in to change notification settings - Fork 153
Bug: SNS envelopes assumes data is always a JSON #3266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
When fixing this, change the |
This issue is now closed. Please be mindful that future comments 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. |
This is now released under v2.13.1 version! |
Expected Behavior
When processing Amazon SNS events using an AWS Lambda function customers can use a built-in envelope to quickly access the contents of the message.
The envelope should be able to process both messages that are plain strings or JSON encoded strings.
Current Behavior
Currently if the
Message
field is a plain text string, the envelope will throw an error because it always attempts toJSON.parse()
it.For example, this fails:
Code snippet
Steps to Reproduce
N/A
Possible Solution
No response
Powertools for AWS Lambda (TypeScript) version
latest
AWS Lambda function runtime
20.x
Packaging format used
npm
Execution logs
Failed to parse envelope. This error was caused by: Unexpected token 'H', "Hello from SNS!" is not valid JSON.
The text was updated successfully, but these errors were encountered: