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

This package does not work with Node 10.x lambda runtime #6

Closed
jderose9 opened this issue Oct 16, 2019 · 2 comments · Fixed by #8
Closed

This package does not work with Node 10.x lambda runtime #6

jderose9 opened this issue Oct 16, 2019 · 2 comments · Fixed by #8

Comments

@jderose9
Copy link

This works for me in node 8 but when I switch to the node 10 lambda runtime I get this error:

2019-10-16T21:00:49.641Z undefined ERROR Uncaught Exception
{
    "errorType": "AssertionError [ERR_ASSERTION]",
    "errorMessage": "Input A expected to strictly equal input B:\n+ expected - actual\n\n- 1\n+ 0",
    "code": "ERR_ASSERTION",
    "stack": [
        "AssertionError [ERR_ASSERTION]: Input A expected to strictly equal input B:",
        "+ expected - actual",
        "",
        "- 1",
        "+ 0",
        "    at clearLambdaExceptionHandlers (/var/task/submit.js:3531:10)",
        "    at registerErrorHandlers (/var/task/submit.js:3498:3)",
        "    at Logger (/var/task/submit.js:3270:5)",
        "    at Module.<anonymous> (/var/task/submit.js:6653:14)",
        "    at __webpack_require__ (/var/task/submit.js:20:30)",
        "    at /var/task/submit.js:84:18",
        "    at Object.<anonymous> (/var/task/submit.js:87:10)",
        "    at Module._compile (internal/modules/cjs/loader.js:778:30)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)",
        "    at Module.load (internal/modules/cjs/loader.js:653:32)"
    ],
    "generatedMessage": true,
    "name": "AssertionError [ERR_ASSERTION]",
    "actual": 1,
    "expected": 0,
    "operator": "strictEqual"
}

I believe it is due to these lines:

const assert = require('assert')
  // Taken from: https://gist.github.com/twolfson/855a823cfbd62d4c7405a38105c23fd3
  // DEV: AWS Lambda's `uncaughtException` handler logs `err.stack` and exits forcefully
  //   uncaughtException listeners = [function (err) { console.error(err.stack); process.exit(1); }]
  //   We remove it so we can catch async errors and report them to Rollbar
  assert.strictEqual(process.listeners('uncaughtException').length, 1)
  assert.strictEqual(process.listeners('unhandledRejection').length, 0)
  process.removeAllListeners('uncaughtException')
  hasAlreadyClearedLambdaHandlers = true
@scionaltera
Copy link

I'm seeing the same thing. process.listeners('unhandledRejection') equals 1 in the Node 10 runtime, so it blows up.

@kyeotic
Copy link
Contributor

kyeotic commented Oct 29, 2019

fix published under 3.1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants