-
-
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
Node: custom onFatalError
does not work
#1925
Comments
Hi, do you have any thoughts on this? It's currently blocking us from upgrading. |
@OliverJAsh Oh, good catch, we will fix this, thank you. Sentry.init({
...
integrations: [
new Sentry.Integrations.OnUncaughtException({
onFatalError: error => {
console.error('Test onFatalError');
console.error(error);
},
}),
],
...
}); |
@HazAT Hello is this fixed? This morning we discovered a fatal error not reported by Sentry Is this the correct setup?
or fatal errors must have additional configuration? |
There's no need to attach |
I just tested it again and Sentry cannot caught Fatal error. I have simulated an out of memory error with the following configuration
Sentry version: The result is that I cannot see anything logged in Sentry. |
Can you set |
I think I can try to reproduce it, hopefully I am doing something wrong, should I open a new issue? |
No need , I'll reopen this one |
OK, I have managed to make something: https://github.com/MatteoGioioso/sentry-fatal-error Please, first of all make sure that I did not make any mistakes in the Sentry configuration, that is the exact config that we have on our server right now, thanks! |
It's not a node exception in this case. It's a process crashing, which produces a core dump (if env is configured appropriately). There is no way for the VM to call any of the handlers when it's out of memory. You can easily confirm this by adding this snippet at the very start of your program. It won't trigger. process.on('exit', (code) => {
console.log(`About to exit with code: ${code}`);
}); Please refer to https://www.javascriptjanuary.com/blog/nodejs-postmortem-debugging-for-fun-and-production on how to debug such issues. Cheers! |
Package + Version
@sentry/browser
@sentry/node
raven-js
raven-node
(raven for node)Version:
Description
I am providing a custom
onFatalError
to Sentry for Node:However, when a fatal exception occurs, the default handler is used instead.
I stepped into the code and discovered that when we construct
OnUncaughtException
, we forget to pass inoptions
:https://github.com/getsentry/sentry-javascript/blob/4.6.3/packages/node/src/sdk.ts#L18
Thus,
options.onFatalError
is alwaysundefined
:https://github.com/getsentry/sentry-javascript/blob/4.6.3/packages/node/src/integrations/onuncaughtexception.ts#L20-L23
I'm surprised TypeScript didn't catch this bug at compile time?
The text was updated successfully, but these errors were encountered: