Title: Cloudflare types for `env` no longer work · Issue #18294 · getsentry/sentry-javascript · GitHub
Open Graph Title: Cloudflare types for `env` no longer work · Issue #18294 · getsentry/sentry-javascript
X Title: Cloudflare types for `env` no longer work · Issue #18294 · 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/18294
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cloudflare types for `env` no longer work","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\n10.26.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\nRepository: https://github.com/Jiralite/sentry-cloudflare-env-reproduction\n\nThere is a very suspicious pull request, #18064, that seems responsible for this as reverting that definition in 10.26.0 correctly infers `env` (this means versions 10.23.0 onwards breaks the types).\n\n### Steps to Reproduce\n\n1. Run TypeScript\n\n### Expected Result\n\n`env` is inferred.\n\n### Actual Result\n\n```\nsource/index.ts:7:44 - error TS18046: 'env' is of type 'unknown'.\n\n7 export default withSentry((env) => ({ dsn: env.SENTRY_DATA_SOURCE_NAME, sendDefaultPii: true }), {\n ~~~\n\nsource/index.ts:8:2 - error TS2322: Type '(_: Request\u003cunknown, IncomingRequestCfProperties\u003cunknown>>, env: Env) => Response' is not assignable to type 'ExportedHandlerFetchHandler\u003cunknown, unknown>'.\n Types of parameters 'env' and 'env' are incompatible.\n Type 'unknown' is not assignable to type 'Env'.\n\n8 fetch(_, env) {\n ~~~~~\n\n node_modules/.pnpm/@cloudflare+workers-types@4.20251121.0/node_modules/@cloudflare/workers-types/2023-07-01/index.d.ts:520:3\n 520 fetch?: ExportedHandlerFetchHandler\u003cEnv, CfHostMetadata>;\n ~~~~~\n The expected type comes from property 'fetch' which is declared here on type 'ExportedHandler\u003cunknown, unknown, unknown>'\n\n\nFound 2 errors in the same file, starting at: source/index.ts:7\n```\n\n### Additional Context\n\n_No response_\n\n### Priority\n\n\u003csub>React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it.\u003c/sub>","author":{"url":"https://github.com/Jiralite","@type":"Person","name":"Jiralite"},"datePublished":"2025-11-23T14:33:37Z","url":"https://github.com/getsentry/sentry-javascript/issues/18294"}
| 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:6b7f26fc-2b46-64b9-1fc1-df1438fa4831 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DF42:31EC7:17B9F:1FBED:6B042FFE |
| html-safe-nonce | 8d84f7000218620480bbd22491027ef4a94038d68be5b523200af0224a058306 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjQyOjMxRUM3OjE3QjlGOjFGQkVEOjZCMDQyRkZFIiwidmlzaXRvcl9pZCI6IjI5Njg1NzMyNjU2NzMwNTIxNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 91b9b0cbe58de48b262433f86c0fddb8fcc8db4de18233808632c944d960e3b4 |
| hovercard-subject-tag | issue:3656074423 |
| 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/18294/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bfdd55bce9bf02a8890d41badafd06d3c2dfbd6d06598b9b30a2bbd2a57683dc/getsentry/sentry-javascript/issues/18294 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bfdd55bce9bf02a8890d41badafd06d3c2dfbd6d06598b9b30a2bbd2a57683dc/getsentry/sentry-javascript/issues/18294 |
| 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 | Jiralite |
| 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