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

process.on('uncaughtException') no longer catches all exception in express #16

Closed
Tony-Donghua-Han opened this issue Nov 3, 2016 · 7 comments

Comments

@Tony-Donghua-Han
Copy link

Tony-Donghua-Han commented Nov 3, 2016

Hi, after using aws-serverless-express, i noticed that node process.on('uncaughtException') of our previous express application doesn't catch all exception from async callbacks anymore. Is there another way to catch all exception that cause the server to crash?

This happens when we use the "request" model and an uncaught exception happens in the callback of an request.

@brettstack
Copy link
Collaborator

Hi @than-speedline, could you provide a minimum reproducible example?

@brettstack
Copy link
Collaborator

unhandledException is not a native event. Try using uncaughtException https://nodejs.org/api/process.html#process_event_uncaughtexception

@Tony-Donghua-Han Tony-Donghua-Han changed the title process.on('unhandledExceptions') no longer catches all exception in express process.on('uncaughtException') no longer catches all exception in express Nov 3, 2016
@Tony-Donghua-Han
Copy link
Author

Sorry, i meant uncaughtException. I'll try to create a simple test case, please give me a sec.

@Tony-Donghua-Han
Copy link
Author

Tony-Donghua-Han commented Nov 4, 2016

Hi, i manage to get an example working. Here is the link to the gist.
https://gist.github.com/than-speedline/f26b0247fbb35dcf465195b06cc97bdb
The exception would be caught locally by runnin app.js, but with the lambda.js and running in a lambda function, the process would instead exit. app.ts is the original typescript.

@Tony-Donghua-Han
Copy link
Author

Just an update, I realized that Lambda doesn't support uncaughtException properly. So i guess this is not the problem with this library. This issue should probably be closed.
P.S. Someone has already asked uncaughtException in the form, here is the link

@jackrk
Copy link

jackrk commented Dec 6, 2016

Thanks for the update!

@jackrk jackrk closed this as completed Dec 6, 2016
@Swivelgames
Copy link

@Tony-Donghua-Han Seems you unfortunately deleted the gist with your fix. That's unfortunate, given that Googlers aren't able to see your solution. 😅

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

4 participants