-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix(node): Avoid catching domain errors in request handler #5627
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This really just re-affirms that we should switch to async hooks soon enough, but for now I think we can . I'll wait on the rest of my team members to take a look as well though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mohd-akram thanks for opening this PR! The change LGTM
It's a bit too late now but this actually ended up being a breaking change for us causing a P0 because we were accidentally relying on this behavior to catch exceptions... I guess we're this person >.< https://xkcd.com/1172/ |
Best XKCD ever. 😄 Sorry you had to deal with the P0, though. |
I @ljearyscg I'm not sure I'm following why this change impacted the sentry-javascript/packages/node/src/handlers.ts Lines 241 to 278 in 1d5c610
If that is no longer the case, would you mind opening a new issue with an explanation and a reproduction example? Would be greatly appreciated, thanks! |
According to the Node.js docs, domain errors are equivalent to an uncaught exception and therefore should not really be caught except to do some cleanup and then exit the process. Not doing so causes the process to potentially linger without being able to handle any request. Currently, the behavior is also erroneous because
next
can end up be called twice. This issue was discovered via fastify/middie#158.Fixes #1922.
yarn lint
) & (yarn test
).