Title: Node: registering `requestHandler` changes error handling behaviour · Issue #1922 · getsentry/sentry-javascript · GitHub
Open Graph Title: Node: registering `requestHandler` changes error handling behaviour · Issue #1922 · getsentry/sentry-javascript
X Title: Node: registering `requestHandler` changes error handling behaviour · Issue #1922 · 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/1922
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Node: registering `requestHandler` changes error handling behaviour","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\nWhen I enable `Sentry.Handlers.requestHandler()` (in Express), asynchronous errors will be:\r\n\r\n- (expected) reported to Sentry\r\n- (unexpected) passed on to my Express error handling middleware\r\n\r\nIt took me a very long time to understand why an async error inside a request handler would lead to different behaviour in development vs production.\r\n\r\nIn development the error would cause the process to die/exit (default behaviour in Node), whereas in production the error would be passed on to my error handling middleware, and an error response would be sent. It turned out this was because we were only enabling the request handler in production.\r\n\r\nI would like to question whether \"passing the error to error handling middleware (by calling `next` and passing the error )\" is really the job of `Sentry.Handlers.requestHandler()`. Perhaps it should *only* report the error? After all, that's the main reason to enable Sentry in an application. This way, conditionally enabling Sentry (e.g. depending on env) would not lead to any other unexpected behaviour changes, such as the one I described above.\r\n\r\nAlternatively, if we think it is the right thing to do, we should document it clearly, along with a suggestion for how to achieve consistent behaviour when the request handler is not enabled (e.g. by using domains like how `Sentry.Handlers.requestHandler()` does it).","author":{"url":"https://github.com/OliverJAsh","@type":"Person","name":"OliverJAsh"},"datePublished":"2019-02-21T21:01:11Z","url":"https://github.com/getsentry/sentry-javascript/issues/1922"}
| 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:b6ceca8a-df65-52b0-9d7b-e5a64bc38901 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A3C8:75E8D:1AA901:23D3BB:6B043009 |
| html-safe-nonce | 19a645f14b4742c0b3102e8fb3151d4bfb86076f90ab3c3c4f57ff24e7c8cdad |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBM0M4Ojc1RThEOjFBQTkwMToyM0QzQkI6NkIwNDMwMDkiLCJ2aXNpdG9yX2lkIjoiMTk0MTk3NDY3Nzc1MTE5MzY5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | eb47bc467e21486df50137a4526c2ca087d82ddaada4321e16d19f22c8d6d4c7 |
| hovercard-subject-tag | issue:413121757 |
| 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/1922/issue_layout |
| twitter:image | https://opengraph.githubassets.com/434ed28e0aec90b68dccfdaf7ddf0ac30df7576dd541cf4b46efef7e1b87e720/getsentry/sentry-javascript/issues/1922 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/434ed28e0aec90b68dccfdaf7ddf0ac30df7576dd541cf4b46efef7e1b87e720/getsentry/sentry-javascript/issues/1922 |
| 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 | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| 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 | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| 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