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

returning a rejected promise from lambda fails under child process mode #982

Closed
leemhenson opened this issue May 21, 2020 · 1 comment
Closed

Comments

@leemhenson
Copy link
Contributor

Bug Report

Operating under:

serverless-offline:
    useChildProcesses: true

when I have a handler function like so:

export const handler = () => Promise.reject("FOO");

when I send a request I see:

FOOOO
FOOOO
(node:68792) UnhandledPromiseRejectionWarning: FOOOO
(Use `node --trace-warnings ...` to show where the warning was created)
(node:68792) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:68792) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

and no response is returned to the client. I have to kill serverless-offline and restart it.

Expected behavior/code

Under:

serverless-offline:
    useChildProcesses: false

I get a 500 response. I expected the child process version to behave the same.

Environment

  • serverless version: 1.71.3
  • serverless-offline version: 6.1.7
  • node.js version: 13.14.0
  • OS: macOS 10.15.3

Additional context/Screenshots

The handler gets invoked here:

https://github.com/dherault/serverless-offline/blob/master/src/lambda/handler-runner/child-process-runner/ChildProcessRunner.js#L52

but when I added additional logging inside the catch block here:

https://github.com/dherault/serverless-offline/blob/master/src/lambda/handler-runner/child-process-runner/ChildProcessRunner.js#L55

I could see it was never getting hit. I also attached childProcess listeners for close, disconnect, error and exit but none are invoked until I kill serverless offline. error is never invoked.

@MorelSerge
Copy link

Same here, and I'm using useChildProcesses because of this issue:
#931

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

No branches or pull requests

3 participants