Title: [sentry/cloudflare] Sentry import breaks Env type · Issue #16099 · getsentry/sentry-javascript · GitHub
Open Graph Title: [sentry/cloudflare] Sentry import breaks Env type · Issue #16099 · getsentry/sentry-javascript
X Title: [sentry/cloudflare] Sentry import breaks Env type · Issue #16099 · 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/16099
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[sentry/cloudflare] Sentry import breaks Env type","articleBody":"### Is there an existing issue for this?\n\n- [X] I have checked for existing issues [https://github.com/getsentry/sentry-javascript/issues](https://github.com/getsentry/sentry-javascript/issues)\n- [X] I have reviewed the documentation [https://docs.sentry.io/](https://docs.sentry.io/)\n- [X] I am using the latest SDK release [https://github.com/getsentry/sentry-javascript/releases](https://github.com/getsentry/sentry-javascript/releases)\n\n### How do you use Sentry?\n\nSentry Saas ([sentry.io](http://sentry.io))\n\n### Which SDK are you using?\n\n@sentry/cloudflare\n\n### SDK Version\n\n9.13.0\n\n### Framework Version\n\nReact Router 7.5.1, Vite 6.3.0, Wrangler 4.12.0\n\n### Link to Sentry event\n\n*No response*\n\n### Reproduction Example/SDK Setup\n\n```\n// worker file: ./workers/app.ts\n\nimport { getLoadContext } from \"load-context\";\nimport { createRequestHandler } from \"react-router\";\nimport * as Sentry from \"@sentry/cloudflare\"; // \u003c-- this line breaks the Env types\n\nconst requestHandler = createRequestHandler(\n () => import(\"virtual:react-router/server-build\"),\n import.meta.env.MODE\n);\n\nexport default {\n async fetch(request, env, ctx) {\n const url = new URL(request.url);\n if (url.pathname.startsWith(\"/r2\")) {\n const key = url.pathname.replace(/^\\/r2\\//, \"\");\n const object = await env.BUCKET.get(key);\n if (!object) {\n return new Response(\"Not found\", { status: 404 });\n }\n return new Response(object.body, {\n headers: { \"Content-Type\": \"image/jpeg\" },\n });\n }\n\n const loadContext = getLoadContext({\n request,\n context: { cloudflare: { env, ctx } },\n });\n return requestHandler(request, loadContext);\n },\n} satisfies ExportedHandler\u003cEnv>;\n```\n\n### Steps to Reproduce\n\n1. installed `@sentry/cloudflare` v9.13.0\n2. added the import to `workers/app.ts`\n `import * as Sentry from \"@sentry/cloudflare\"; // \u003c-- this line breaks the Env types`\n3. my env types break in when i typecheck\n4. commenting out the import fixes the type errors\n `// import * as Sentry from \"@sentry/cloudflare\";`\n\n### Expected Result\n\nTypes should not be corrupted by import Sentry\n\n### Actual Result\n\n### Broken:\n\n\n\n\n\n### Working (when import is commented out):\n\n","author":{"url":"https://github.com/shmuli9","@type":"Person","name":"shmuli9"},"datePublished":"2025-04-21T12:55:01Z","url":"https://github.com/getsentry/sentry-javascript/issues/16099"}
| 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:d6cc8e35-cd06-5f26-3cd5-163d640e77bc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8520:2876DA:FC1AD9:148EA4C:6B04ED5B |
| html-safe-nonce | b0e3828c20c36612a7a6ab889fe757e698a0e80345eb3765861707519f893c9e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NTIwOjI4NzZEQTpGQzFBRDk6MTQ4RUE0Qzo2QjA0RUQ1QiIsInZpc2l0b3JfaWQiOiIyMTM2MjYzOTA2NzI4MTQ0MjE5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e6f4ee45a8a377d92bedeb1911f508d60019f94ba5684847fc149d7fa82f868e |
| hovercard-subject-tag | issue:3008359591 |
| 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/16099/issue_layout |
| twitter:image | https://opengraph.githubassets.com/131772c5cd5c2d65b4bface5b0f75bfb5376dcadd394df980ff9d12ac32a3d1e/getsentry/sentry-javascript/issues/16099 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/131772c5cd5c2d65b4bface5b0f75bfb5376dcadd394df980ff9d12ac32a3d1e/getsentry/sentry-javascript/issues/16099 |
| 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 | shmuli9 |
| hostname | github.com |
| expected-hostname | github.com |
| None | f3851aad500d8e8dce736722ddc6fa9596e17d9fce3c53581eba968664c0bc32 |
| 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 | e29c922455fd8137f27e1cfcdf6a1e8b920b1926 |
| 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