Title: Node: custom `onFatalError` does not work · Issue #1925 · getsentry/sentry-javascript · GitHub
Open Graph Title: Node: custom `onFatalError` does not work · Issue #1925 · getsentry/sentry-javascript
X Title: Node: custom `onFatalError` does not work · Issue #1925 · getsentry/sentry-javascript
Description: Review the documentation: https://docs.sentry.io/ Search for existing issues: https://github.com/getsentry/sentry-javascript/issues Use the latest release: https://github.com/getsentry/sentry-javascript/releases Package + Version @sentry...
Open Graph Description: Review the documentation: https://docs.sentry.io/ Search for existing issues: https://github.com/getsentry/sentry-javascript/issues Use the latest release: https://github.com/getsentry/sentry-javas...
X Description: Review the documentation: https://docs.sentry.io/ Search for existing issues: https://github.com/getsentry/sentry-javascript/issues Use the latest release: https://github.com/getsentry/sentry-javas...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/1925
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Node: custom `onFatalError` does not work","articleBody":"\u003c!-- Requirements: please go through this checklist before opening a new issue -->\r\n\r\n- [x] Review the documentation: https://docs.sentry.io/\r\n- [x] Search for existing issues: https://github.com/getsentry/sentry-javascript/issues\r\n- [x] Use the latest release: https://github.com/getsentry/sentry-javascript/releases\r\n\r\n## Package + Version\r\n\r\n- [ ] `@sentry/browser`\r\n- [x] `@sentry/node`\r\n- [ ] `raven-js`\r\n- [ ] `raven-node` _(raven for node)_\r\n- [ ] other:\r\n\r\n### Version:\r\n\r\n```\r\n4.6.3\r\n```\r\n\r\n## Description\r\n\r\nI am providing a custom `onFatalError` to Sentry for Node:\r\n\r\n``` ts\r\nimport * as Sentry from '@sentry/node';\r\n\r\nconst options: Sentry.NodeOptions = {\r\n // …\r\n onFatalError: error => {\r\n console.error('Test onFatalError')\r\n console.error(error)\r\n },\r\n // …\r\n};\r\nSentry.init(options);\r\n```\r\n\r\nHowever, when a fatal exception occurs, the [default handler](https://github.com/getsentry/sentry-javascript/blob/4.6.3/packages/node/src/handlers.ts#L281) is used instead.\r\n\r\nI stepped into the code and discovered that when we construct `OnUncaughtException`, we forget to pass in `options`:\r\n\r\nhttps://github.com/getsentry/sentry-javascript/blob/4.6.3/packages/node/src/sdk.ts#L18\r\n\r\nThus, `options.onFatalError` is always `undefined`:\r\n\r\nhttps://github.com/getsentry/sentry-javascript/blob/4.6.3/packages/node/src/integrations/onuncaughtexception.ts#L20-L23\r\n\r\nI'm surprised TypeScript didn't catch this bug at compile time?","author":{"url":"https://github.com/OliverJAsh","@type":"Person","name":"OliverJAsh"},"datePublished":"2019-02-25T09:23:31Z","url":"https://github.com/getsentry/sentry-javascript/issues/1925"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:17aea651-4c9f-4fff-1c1a-6ae462414661 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D4BC:344084:933314:CE25EC:6B0483CC |
| html-safe-nonce | 2bf31af29b3303abbd8fb611e19b15ee7f73598b670c355e6e5c3f7c70d7918a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENEJDOjM0NDA4NDo5MzMzMTQ6Q0UyNUVDOjZCMDQ4M0NDIiwidmlzaXRvcl9pZCI6IjEzNDEzMjUzNDQ5Njc1MjUzMjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0e600e6c802ab51f6c95f0c333dc55015115de80305090f81b2bfb9633c02b09 |
| hovercard-subject-tag | issue:414007011 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/1925/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2a473aca1109e89f9a90b41fd5c07412fb3288c4ea7f6a960ec0b22e5727d208/getsentry/sentry-javascript/issues/1925 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2a473aca1109e89f9a90b41fd5c07412fb3288c4ea7f6a960ec0b22e5727d208/getsentry/sentry-javascript/issues/1925 |
| og:image:alt | Review the documentation: https://docs.sentry.io/ Search for existing issues: https://github.com/getsentry/sentry-javascript/issues Use the latest release: https://github.com/getsentry/sentry-javas... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | OliverJAsh |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1d5c152376e38b7d2e37f3d5179be29a73bee93b85110da28a4eebe1159cdc70 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f5017e8ff4ea25a8011fcf0f2a0e430c60dc86c8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width