Title: `@sentry/cloudflare` 11: instrumented Durable Object stubs drop method, headers and body when `init` is a `Request` · Issue #26367 · getsentry/sentry-javascript · GitHub
Open Graph Title: `@sentry/cloudflare` 11: instrumented Durable Object stubs drop method, headers and body when `init` is a `Request` · Issue #26367 · getsentry/sentry-javascript
X Title: `@sentry/cloudflare` 11: instrumented Durable Object stubs drop method, headers and body when `init` is a `Request` · Issue #26367 · getsentry/sentry-javascript
Description: Note: This issue was written by my clanker. While I try to verify its steps as much as possible, it might not be 100% correct. Package and version @sentry/cloudflare 11.12.0 (also on develop at the time of writing). Description instrumen...
Open Graph Description: Note: This issue was written by my clanker. While I try to verify its steps as much as possible, it might not be 100% correct. Package and version @sentry/cloudflare 11.12.0 (also on develop at the...
X Description: Note: This issue was written by my clanker. While I try to verify its steps as much as possible, it might not be 100% correct. Package and version @sentry/cloudflare 11.12.0 (also on develop at the...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/26367
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`@sentry/cloudflare` 11: instrumented Durable Object stubs drop method, headers and body when `init` is a `Request`","articleBody":"*__Note:__ This issue was written by my clanker. While I try to verify its steps as much as possible, it might not be 100% correct.*\n\n---\n\n### Package and version\n\n`@sentry/cloudflare` 11.12.0 (also on `develop` at the time of writing).\n\n### Description\n\n`instrumentFetcher` (`packages/cloudflare/src/instrumentations/worker/instrumentFetcher.ts`) builds the\noutgoing init with an object spread:\n\n```ts\nconst mergedInit = { ...init, ...(headers ? { headers } : {}) }\nreturn fetchFn(input, mergedInit)\n```\n\nThe Fetch standard accepts any object as `RequestInit`, and forwarding a request as\n`stub.fetch(url, request)` is a common Workers idiom. A `Request`'s `method`, `headers`, `body` and the\nrest are prototype getters, not own properties, so the spread copies none of them. Behind an instrumented\nDurable Object namespace the call reaches the object as a bare `GET` with no headers and no body, so a\nWebSocket upgrade (`Upgrade: websocket`) and every forwarded `POST` fail. Without Sentry the same call\nworks.\n\n### Reproduction\n\n```js\nimport { instrumentFetcher } from '@sentry/cloudflare/build/esm/prod/instrumentations/worker/instrumentFetcher.js'\n\nconst received = []\nconst stubFetch = async (input, init) => {\n received.push(new Request(input, init))\n return new Response('ok')\n}\nconst incoming = new Request('https://example.com/room/ABC/websocket', {\n method: 'POST',\n headers: { Upgrade: 'websocket', 'Content-Type': 'application/json' },\n body: '{\"a\":1}',\n})\n\nawait stubFetch('https://internal/websocket', incoming.clone())\nawait instrumentFetcher(stubFetch)('https://internal/websocket', incoming.clone())\n\nfor (const [label, request] of [['plain stub', received[0]], ['instrumented stub', received[1]]]) {\n console.log(label, request.method, request.headers.get('upgrade'), JSON.stringify(await request.text()))\n}\n```\n\nOutput on Node 22:\n\n```text\nplain stub POST websocket \"{\\\"a\\\":1}\"\ninstrumented stub GET null \"\"\n```\n\n### Expected\n\nThe instrumented stub forwards what the plain stub forwards, with the tracing headers added.\n\n### Suggested fix\n\nNormalise to one `Request` when `init` is a `Request` (or always, when `init` is given), as the\n`init === undefined` branch already does:\n\n```ts\nif (init instanceof Request || (input instanceof Request && init === undefined)) {\n const request = new Request(input, init)\n return fetchFn(headers ? new Request(request, { headers }) : request)\n}\n```\n\n### Workaround\n\nPass one `Request`: `stub.fetch(new Request(url, request))`.\n","author":{"url":"https://github.com/webbertakken","@type":"Person","name":"webbertakken"},"datePublished":"2026-11-13T17:47:46Z","url":"https://github.com/getsentry/sentry-javascript/issues/26367"}
| 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:7ec1ac67-b396-b35b-f8f6-2a9e3fdb53ac |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EE38:38627B:22E0D7:2F1825:6B043208 |
| html-safe-nonce | 2dbee91ffc07daad210d431601e69a7324c74e1a8b2adbca507e6f375ff33665 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRTM4OjM4NjI3QjoyMkUwRDc6MkYxODI1OjZCMDQzMjA4IiwidmlzaXRvcl9pZCI6IjU5NjU4NjkxNTk3NDQyODcyNDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b41a84d6105870e6abe4e73b1b1193f0cf55f79dcf62237429aaf264e70cd7c5 |
| hovercard-subject-tag | issue:6376872794 |
| 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/26367/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9fada7a16aa957596fec95eb8650641f87f11472efc02021d7feff03494adc9b/getsentry/sentry-javascript/issues/26367 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9fada7a16aa957596fec95eb8650641f87f11472efc02021d7feff03494adc9b/getsentry/sentry-javascript/issues/26367 |
| og:image:alt | Note: This issue was written by my clanker. While I try to verify its steps as much as possible, it might not be 100% correct. Package and version @sentry/cloudflare 11.12.0 (also on develop at the... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | webbertakken |
| 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