Skip to content
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

SDK: Fix AWS Lambda Powertools error log parsing #767

Merged
merged 4 commits into from
May 18, 2023

Conversation

medikoo
Copy link
Contributor

@medikoo medikoo commented May 18, 2023

When browsing internal error reports. I found following:

{
  "message": "undefined is not iterable (cannot read property Symbol(Symbol.iterator))",
  "name": "TypeError",
  "stacktrace": "at handleErrorLog (/opt/nodejs/node_modules/@serverless/sdk/index.js:3622:34)\nat module2.exports.attemptParseStructuredLogAndCapture (/opt/nodejs/node_modules/@serverless/sdk/index.js:3662:13)\nat nodeStdout.write (/opt/nodejs/node_modules/@serverless/sdk/index.js:3698:9)\nat Console.log (/var/task/src/triggers/handle-db-change.js:201027:23)\nat Console._write (/var/task/src/triggers/handle-db-change.js:198701:19)\nat doWrite (/var/task/src/triggers/handle-db-change.js:118934:139)\nat writeOrBuffer (/var/task/src/triggers/handle-db-change.js:118925:5)\nat Writable.write (/var/task/src/triggers/handle-db-change.js:118846:11)\nat DerivedLogger.ondata (/var/task/src/triggers/handle-db-change.js:117942:20)\nat DerivedLogger.emit (node:events:513:28)",
  "type": "ERROR_TYPE_CAUGHT_SDK_INTERNAL"
}

It appears there's a bug when processing an AWS Lambda Powertools error log which was written without passing the error instance.

This patch ensures it's handled gently

@medikoo medikoo added bug Something isn't working runtime/node.js labels May 18, 2023
@medikoo medikoo self-assigned this May 18, 2023
@medikoo medikoo requested a review from Danwakeem May 18, 2023 15:46
Copy link
Contributor

@Danwakeem Danwakeem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@medikoo medikoo merged commit fcb6fe7 into main May 18, 2023
@medikoo medikoo deleted the 0518-fix-sdk-error-parsing branch May 18, 2023 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working runtime/node.js
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants