Title: Sentry Remix integration reports thrown redirects as errors · Issue #9906 · getsentry/sentry-javascript · GitHub
Open Graph Title: Sentry Remix integration reports thrown redirects as errors · Issue #9906 · getsentry/sentry-javascript
X Title: Sentry Remix integration reports thrown redirects as errors · Issue #9906 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using the latest SDK release https://github.com/...
Open Graph Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
X Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/9906
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Sentry Remix integration reports thrown redirects as errors","articleBody":"### Is there an existing issue for this?\n\n- [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [X] I have reviewed the documentation https://docs.sentry.io/\n- [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Which SDK are you using?\n\n@sentry/remix\n\n### SDK Version\n\n7.88.0\n\n### Framework Version\n\nRemix 2.4.0\n\n### Link to Sentry event\n\nhttps://mining-syndicate.sentry.io/issues/4725655099/?environment=development&project=6347078&query=is%3Aunresolved&referrer=issue-stream&statsPeriod=30d&stream_index=0&utc=true\n\n### SDK Setup\n\nentry.server.ts\r\n```\r\nSentry.init({\r\n dsn: SENTRY_DSN,\r\n environment: SENTRY_ENV,\r\n tracesSampler(ctx) {\r\n if (ctx.request?.url?.includes('healthcheck') || ctx.location?.pathname.includes('healthcheck')) {\r\n return 0;\r\n }\r\n\r\n return SENTRY_ENV === 'production' ? 0.1 : 1;\r\n },\r\n});\r\n```\r\n\r\nentry.client.tsx\r\n```\r\nSentry.init({\r\n dsn: window.ENV.SENTRY_DSN,\r\n environment: window.ENV.SENTRY_ENV,\r\n tracesSampleRate: window.ENV.SENTRY_ENV === 'production' ? 0.1 : 1,\r\n replaysSessionSampleRate: 0.1,\r\n replaysOnErrorSampleRate: 1,\r\n\r\n integrations: [\r\n new Sentry.BrowserTracing({\r\n routingInstrumentation: Sentry.remixRouterInstrumentation(React.useEffect, useLocation, useMatches),\r\n }),\r\n new Sentry.Replay(),\r\n ],\r\n});\r\n```\r\n\r\nserver.js (custom express server)\r\n```\r\nconst sentryCreateRequestHandler = wrapExpressCreateRequestHandler(createRequestHandler);\r\n...\r\nconst remixHandler =\r\n MODE === 'development'\r\n ? await createDevRequestHandler(initialBuild)\r\n : sentryCreateRequestHandler({\r\n build: initialBuild,\r\n mode: initialBuild.mode,\r\n getLoadContext,\r\n });\r\n```\n\n### Steps to Reproduce\n\nIn my loaders I have a function that checks if the user exists. If the user does not exist, I throw a redirect response.\r\n\r\ne.g.\r\n```\r\nexport function loader({request) {\r\n if (!getUser(request)) {\r\n throw new redirect('/login');\r\n }\r\n}\r\n```\n\n### Expected Result\n\nThe thrown redirect should be ignored by Sentry instead of logged as an error\n\n### Actual Result\n\nThe redirects are being flagged as errors.\r\n\r\nI believe this could have been introduced by these lines in the following PR: https://github.com/getsentry/sentry-javascript/commit/69b308d1c97e8e59fa9088fe369806ebe527323b#diff-754e32c1c14ac3c3c93eedeb7680548b986bc02a8b0bc63d2efc189210322acdR84-R88\r\n\r\nIf you notice, it used to check if the error is a response object, however there was logic added to check if we are in Remix V2, and to only check if the error is a RouteErrorResponse (which is different).\r\n\r\nPerhaps the logic here should be (notice removal of the else)\r\n```\r\n if (IS_REMIX_V2 && isRouteErrorResponse(err) && err.status \u003c 500) {\r\n return;\r\n }\r\n \r\n if (isResponse(err) && err.status \u003c 500) {\r\n return;\r\n }\r\n```","author":{"url":"https://github.com/justinwaite","@type":"Person","name":"justinwaite"},"datePublished":"2023-12-19T01:17:21Z","url":"https://github.com/getsentry/sentry-javascript/issues/9906"}
| 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:ca1ef81e-0dcf-56a3-f3dd-83a4298f743f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E2E6:CD950:1C5D2:25DD6:6B03FAD3 |
| html-safe-nonce | 27a191d96dbc42885a1e6bcfdce2e90443141597c7e249d95c43bac8e90e5d77 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMkU2OkNEOTUwOjFDNUQyOjI1REQ2OjZCMDNGQUQzIiwidmlzaXRvcl9pZCI6IjcxMzY4NDg4OTcyOTY4MjUwNDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e27590d9b30a3e0302ba6316b41a3961dc5ea28aefbfb8657ea860c00a29532d |
| hovercard-subject-tag | issue:2047748717 |
| 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/9906/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5290780d7fa8988b9c627df557e0de92771afca981418d782fd22524f2cfbb24/getsentry/sentry-javascript/issues/9906 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5290780d7fa8988b9c627df557e0de92771afca981418d782fd22524f2cfbb24/getsentry/sentry-javascript/issues/9906 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | justinwaite |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| 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