Skip to content

Conversation

@JPeer264
Copy link
Member

@JPeer264 JPeer264 commented Jan 5, 2026

This adds the workaround until v11 is out. At the moment we have to explicitly set (env: Env) => ... in order to make the types work. This can be reverted (no must) when following is merged and released: getsentry/sentry-javascript#18302

reference: getsentry/sentry-javascript#18294 (comment)

@JPeer264 JPeer264 requested review from Lms24 and andreiborza January 5, 2026 16:11
@JPeer264 JPeer264 requested a review from a team as a code owner January 5, 2026 16:11
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 5, 2026
export default Sentry.withSentry(
env => ({
(env: Env) => ({
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The Cloudflare Workers onboarding guide provides a code snippet using the Env type but omits the required wrangler types command to generate it, causing a TypeScript error.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

The onboarding documentation for Cloudflare Workers provides code snippets that use the Env type, for example in (env: Env) => and satisfies ExportedHandler<Env>. However, the Env type is not globally available and must be generated by running the wrangler types command. The current onboarding instructions do not mention this prerequisite step. Consequently, users who copy and paste the provided code into their TypeScript project will encounter a compilation error: "Cannot find name 'Env'". This blocks them from successfully completing the SDK setup as documented.

💡 Suggested Fix

Update the Cloudflare Workers onboarding documentation to include a step instructing the user to run npx wrangler types before they are prompted to use the code snippet. This will ensure the Env type definition is generated and available to the TypeScript compiler.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: static/app/gettingStartedDocs/node-cloudflare-workers/onboarding.tsx#L28

Potential issue: The onboarding documentation for Cloudflare Workers provides code
snippets that use the `Env` type, for example in `(env: Env) =>` and `satisfies
ExportedHandler<Env>`. However, the `Env` type is not globally available and must be
generated by running the `wrangler types` command. The current onboarding instructions
do not mention this prerequisite step. Consequently, users who copy and paste the
provided code into their TypeScript project will encounter a compilation error: "Cannot
find name 'Env'". This blocks them from successfully completing the SDK setup as
documented.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 8175928

@JPeer264 JPeer264 merged commit 7eac13b into master Jan 8, 2026
53 checks passed
@JPeer264 JPeer264 deleted the jp/env-workers branch January 8, 2026 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants