Title: Remix: Throwing a 4XX/5XX Response causes a "body already used for" error · Issue #5423 · getsentry/sentry-javascript · GitHub
Open Graph Title: Remix: Throwing a 4XX/5XX Response causes a "body already used for" error · Issue #5423 · getsentry/sentry-javascript
X Title: Remix: Throwing a 4XX/5XX Response causes a "body already used for" error · Issue #5423 · 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/5423
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Remix: Throwing a 4XX/5XX Response causes a \"body already used for\" error","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 package are you using?\n\n@sentry/remix\n\n### SDK Version\n\n7.7.0\n\n### Framework Version\n\n7.7.0\n\n### Link to Sentry event\n\n_No response_\n\n### Steps to Reproduce\n\nRemix lets you throw responses for things like a 404 Not Found:\r\n\r\n```typescript\r\nexport const loader = async () => {\r\n throw new Response(\"Not Found\", { status: 404 });\r\n};\r\n```\r\n\r\nYou would then use a remix CatchBoundary to catch the 404 and display a message. To reproduce, just add the loader above to any route and try to open the page.\n\n### Expected Result\n\nSentry should pass the 404 through and allow the CatchBoundary to show it. It worked fine in 7.6.0.\n\n### Actual Result\n\nAs of 7.7.0, @sentry/remix is causing the following error when loading any page that throws a response. It only happens if the page was server rendered, e.g. given a route `/foo` that throws a 404, if I load `/foo` directly and it server renders, it crashes with the error below. If I load `/` first, then navigate client-side to `/foo`, it uses the catch boundary properly. I assume this is related to the updates in https://github.com/getsentry/sentry-javascript/pull/5405 since it worked fine in 7.6.0 and that PR addressed some thrown responses.\r\n\r\n```\r\nTypeError: body used already for: \r\n at consumeBody (/Users/dylan/dev/smp/node_modules/@remix-run/web-fetch/src/body.js:205:9)\r\n at NodeResponse.text (/Users/dylan/dev/smp/node_modules/@remix-run/web-fetch/src/body.js:171:24)\r\n at Object.extractData (/Users/dylan/dev/smp/node_modules/@remix-run/server-runtime/dist/data.js:138:19)\r\n at handleDocumentRequest (/Users/dylan/dev/smp/node_modules/@remix-run/server-runtime/dist/server.js:331:28)\r\n at requestHandler (/Users/dylan/dev/smp/node_modules/@remix-run/server-runtime/dist/server.js:49:18)\r\n at /Users/dylan/dev/smp/node_modules/@sentry/remix/cjs/utils/instrumentServer.js:167:16\r\n at /Users/dylan/dev/smp/node_modules/@remix-run/express/dist/server.js:39:22\r\n```\r\n\r\nIt's just raw text from the server, not handled by any ErrorBoundary. If I throw a standard Error object instead, it uses the ErrorBoundary.","author":{"url":"https://github.com/dmarkow","@type":"Person","name":"dmarkow"},"datePublished":"2022-07-15T15:10:19Z","url":"https://github.com/getsentry/sentry-javascript/issues/5423"}
| 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:a5837032-bde6-6145-b63d-e255631280b4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E53A:3F470D:7B644B:A99B9A:6B04AADB |
| html-safe-nonce | 67f72824e64b25dc1ff1de58e42791c9cb011fc3ae1dd4b46db6578f6b5e976b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNTNBOjNGNDcwRDo3QjY0NEI6QTk5QjlBOjZCMDRBQURCIiwidmlzaXRvcl9pZCI6IjIxOTA4Njg1MTQ2MTE3MDI0OTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 285a8a8e6cdde2e30152075db28c02e6ce8011ae1a16062e199077ee46aeace7 |
| hovercard-subject-tag | issue:1306152241 |
| 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/5423/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8e1c0764b1291e0370a44bef966870a06d7f8a539ce56c0ff098e7d4571f4dc6/getsentry/sentry-javascript/issues/5423 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8e1c0764b1291e0370a44bef966870a06d7f8a539ce56c0ff098e7d4571f4dc6/getsentry/sentry-javascript/issues/5423 |
| 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 | dmarkow |
| hostname | github.com |
| expected-hostname | github.com |
| None | f1d110ea058a0915c1d8aa3fc2069fa15801e128f591e5762525abe77490ecb1 |
| 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 | ffa22a65e4c46d376940fe34b05e6a7e9c7fdb9b |
| 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