Title: Cloudflare Websocket with Durable Objects not working · Issue #15975 · getsentry/sentry-javascript · GitHub
Open Graph Title: Cloudflare Websocket with Durable Objects not working · Issue #15975 · getsentry/sentry-javascript
X Title: Cloudflare Websocket with Durable Objects not working · Issue #15975 · 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/15975
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cloudflare Websocket with Durable Objects not working","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/cloudflare\n\n### SDK Version\n\n9.11.0\n\n### Framework Version\n\n_No response_\n\n### Link to Sentry event\n\n_No response_\n\n### Reproduction Example/SDK Setup\n\n```\nimport { DurableObject } from \"cloudflare:workers\";\nimport * as Sentry from '@sentry/cloudflare';\n\n// Worker with Sentry wrapper\nexport default Sentry.withSentry(\n\tenv => ({\n\t\tdsn: env.SENTRY_DSN,\n\n\t}),\n\t{\n\t\tasync fetch(request, env, ctx) {\n\t\t\t// Handle WebSocket requests\n\t\t\tif (request.url.includes(\"/websocket\")) {\n\t\t\t\t// Get DO stub\n\t\t\t\tconst id = env.WEBSOCKET_SERVER.idFromName(\"user-id\");\n\t\t\t\tconst stub = env.WEBSOCKET_SERVER.get(id);\n\n\t\t\t\t// Forward to DO\n\t\t\t\treturn await stub.fetch(request);\n\t\t\t}\n\n\t\t\treturn new Response(\"Not a WebSocket request\");\n\t\t},\n\t}\n);\n\n// Durable Object for WebSocket\nexport class WebSocketServer extends DurableObject {\n\tconstructor(ctx, env) {\n\t\tsuper(ctx, env);\n\t}\n\n\tasync fetch(request) {\n\t\t// Verify WebSocket upgrade\n\t\tconst upgradeHeader = request.headers.get(\"Upgrade\");\n\t\tif (!upgradeHeader || upgradeHeader.toLowerCase() !== \"websocket\") {\n\t\t\treturn new Response(\"Expected WebSocket\", { status: 426 });\n\t\t}\n\n\t\t// Create WebSocket pair\n\t\tconst webSocketPair = new WebSocketPair();\n\t\tconst [client, server] = Object.values(webSocketPair);\n\n\t\t// Accept the server side\n\t\tserver.accept();\n\n\t\t// Basic message handler\n\t\tserver.addEventListener(\"message\", (event) => {\n\t\t\tserver.send(\"Echo: \" + event.data);\n\t\t});\n\n\t\tSentry.captureException(new Error('Testing sentry'));\n\n\n\t\t// Return client WebSocket\n\t\treturn new Response(null, {\n\t\t\tstatus: 101,\n\t\t\twebSocket: client\n\t\t});\n\t}\n}\n ```\n\n### Steps to Reproduce\n\nJust added a test exception, did not show up.\n\n\n### Expected Result\n\nShould have received the error in dashboard.\n\n\n### Actual Result\n\nDid not show.\nHowever, it does work when running the worker locally. ","author":{"url":"https://github.com/LawrenceGB","@type":"Person","name":"LawrenceGB"},"datePublished":"2025-04-03T16:23:26Z","url":"https://github.com/getsentry/sentry-javascript/issues/15975"}
| 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:4cd33d07-436c-222d-84df-0c776fa3379c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9780:FD77C:C24A86:FD31F0:6B04DB73 |
| html-safe-nonce | 5150e702c09378f4dd18d49fba58dcfd8b4b7b6d771968bf89f8cfcf7714ddf4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NzgwOkZENzdDOkMyNEE4NjpGRDMxRjA6NkIwNERCNzMiLCJ2aXNpdG9yX2lkIjoiNjk3ODUwNTc3NTM1NDUzNDc3MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e70861a30e3a67db973b81cacadcbb052b167476a7a87389077bd7a8cff42e0d |
| hovercard-subject-tag | issue:2970120900 |
| 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/15975/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c6ae2bfd7d4685909d216f434b2a363adcf64b63af7f5dc29406d96d6299273a/getsentry/sentry-javascript/issues/15975 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c6ae2bfd7d4685909d216f434b2a363adcf64b63af7f5dc29406d96d6299273a/getsentry/sentry-javascript/issues/15975 |
| 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 | LawrenceGB |
| hostname | github.com |
| expected-hostname | github.com |
| None | 194dacb8acfd3e4d3ffb2704e0b1f10327f0dad690a7142acc7b0e0a2d073965 |
| 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 | 6c35540a0a2991ee20bd053ba2601cce33f72cb1 |
| 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