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
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 of logEvents[*].
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:
2024-10-21T14:31:16.011Z 1b55f3ae-54f6-4e5c-820f-fe4091cb7f14 ERROR Invoke Error {
"errorType": "ParseError",
"errorMessage": "Failed to parse envelope. This error was caused by: Unexpected non-whitespace character after JSON at position 4.",
"name": "ParseError",
"stack": [
"ParseError: Failed to parse envelope. This error was caused by: Unexpected non-whitespace character after JSON at position 4.",
" at Object.parse (file:///var/task/index.mjs:2:69766)",
" at file:///var/task/index.mjs:2:82281",
" at Array.map (<anonymous>)",
" at Object.parse (file:///var/task/index.mjs:2:82272)",
" at Runtime.Vl [as handler] (file:///var/task/index.mjs:2:82763)",
" at Runtime.handleOnceNonStreaming (file:///var/runtime/index.mjs:1173:29)"
]
}
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:
While working on this, we should also modify the envelope to return the entirety of logEvents rather than logEvents[*].message only.
After discussing this internally with the Python team, we agreed that the reference implementation in Python could be improved. The reasoning is that when processing log messages, the message alone without the timestamp is kind of useless.
The Python version won't be able to fix this soon due to it being a breaking change, for us we'll fix this in a minor release since the current implementation is completely broken and as such, it's unlikely any customer is relying on the current behavior.
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:
{ "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Olmrmea0QKvEV2SS4I0qCs4FAwQYBS0ohKAdBZGLVzb5aBSb2woKO/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: