Bug: CloudWatch envelope assumes data is always a JSON #3225
Labels
bug
Something isn't working
parser
This item relates to the Parser Utility
pending-release
This item has been merged and will be released soon
Expected Behavior
When processing Amazon CloudWatch Logs using an AWS Lambda function subscription, the logs are forwarded to the function. By using an envelope, customers can quickly access the contents of the message.
The envelope should decode the
awslogs.data
key and return the content oflogEvents[*]
.Current Behavior
Currently with an event that looks like the one below (see "details" for decoded version), the function throws an error because not all messages can be parsed as JSON strings:
{ "awslogs": { "data": "H4sIAAAAAAAA/81VTW/bRhD9K8SiR9Ga2Z2Z3eFNjuUkRR0HltpDQsNYkSuHqD5ckrbjGv7vhRSnNdrIkJEceiNm3y7eezPzeG+WqeviZZreXSVTmKPRdHRxMp5MRq/HZmDWt6vUmsKwE8tkgdCKGZjF+vJ1u76+MoUZxttuuIjLWR2H3XqZ8nX/KbX5Ki7TF+Ckb1NcmsJYsDREGFocnm4wx6uPP/0ymo4n03OUCj1Hnge1JDHGmqvgQ0yzmFKsvBmY7nrWVW1z1Tfr1XGz6FPbmeKjeXXbt83lZWonfax+z0/uJk9wr1TGeHzIeYWjN5+mlm7Cz5/M+ZbW+Cat+s0T96apTWFcYFEB8hqIHbLzQohsJYAnJ44kECqSMnoEx+QCWtCNG32zTF0fl1emQG+VLQRl5DD46u2j+BwhtzhFKmwokA+Qw4eyT7GuFKuQB+tdTtHW+Qw95DOIPgQ3E9RU9m/fHZ+W/Zu0WKyzebteZlubD/quXJmHwfdp8HtqmExHZ9PsLP1xnbr+bV1k+1DPfktt16xXRfbY7F2EPRMTgzp0XoOoZ2AAQufJWhQmYSD1ahlpN2F9Svi+NIt0kxalKUqzddAMyq/n2+K3DN1guri8WjSry4s29hskbGqpvWmqL/cevy+uV3WaN6tUb2/9zWmL2dnyDfRzG+8u+jZW6aKpt3DMxaMIzee56AxS5cUSWZeAmKgC6+aledjhHlsAZlX1CIFVyfkQwDN7p+JJLIYAgp6do93tFnzq3vjd0Uub/QPYhT3ZnY3fn758Gsv+6LqN/XYe7QH4bNmV/WGzWKQ6++fEbcsnablu77JJ82cqMrQhOzks+5P4OXs8+LVLdZGJ39a/pTw46606VXRkWYLjQFbBBfEEZBGAgnfBOvaIpG6HchHlZ9dQ2JGdhZTXhJITQ53rHCAP6GNVOYS6cnut4YYwo6gGr8TsREhkM37g0FoKVtSDqicURUXYTViezz45EJUPZb8P8xdm30aDJwAQS8IuqIegGERdCLSZOUdMgpa8eOvsrmUQUf9/jpJHB5+NEgbIKUUOlmrmea0QKvEV2SS4I0qCs4FAwQYBS0ohKAdBZGLVzb5aBSb2woKO/a6/n3iAZ6Jkr7Z/P7udvf0Xu/9GyX5z+TRKnPuhUXL+8BdONu+NmQkAAA==" } }
Error:
Code snippet
N/A
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
No response
The text was updated successfully, but these errors were encountered: