Repository navigation
fix(cli): instrument new Cloudflare workers and harden the Wrangler flow - #2563
sentry-junior[bot] wants to merge 1 commit into
Conversation
Changes how the ported source maps and Cloudflare wizards behave where sentry-wizard 9.1.0 left a project half set up: - Cloudflare: create a missing entry point where Wrangler's `main` points, and wrap new and existing workers with `Sentry.withSentry()` - Cloudflare: show `main` in the wrangler.toml snippet when it is added - webpack: keep a non-array `plugins` value by spreading it - Wrangler: keep an existing `post<deploy>` script, chain the upload onto the deploy script for Yarn 2+, and still set up the upload script and CLI config when no deploy script is picked - Wrangler: edit deploy scripts that run wrangler through npx, pnpm exec, yarn, bunx, or cross-env, and show the flags to add when it can't - Source maps: offer the SvelteKit or React Native wizard only when this version has it
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 347f342. Configure here.
| clack.log.success(`Created ${chalk.cyan(defaultEntryPoint)}.`); | ||
|
|
||
| return; | ||
| clack.log.success(`Created ${chalk.cyan(entryPoint)}.`); |
There was a problem hiding this comment.
TS starter written to non-TS paths
Medium Severity
When Wrangler main points at a missing file, the wizard now writes getCloudflareWorkerTemplateWithHandler() to that path. That template is TypeScript (satisfies, type annotations) regardless of extension, so a missing .js or .mjs entry becomes invalid JavaScript and Wrangler cannot bundle it.
Reviewed by Cursor Bugbot for commit 347f342. Configure here.


Stacked on #2529. These fixes address Warden and Bugbot findings on that PR, and each one changes behaviour that sentry-wizard 9.1.0 shipped, so they're kept apart from the port. The fixes that keep upstream behaviour are on #2529 itself.
Behaviour changes against sentry-wizard 9.1.0
mainfile (SHJ-RG7): when Wrangler'smainpoints to a file that doesn't exist, the wizard creates the starter worker there and wraps it. Upstream skipped setup silently and still reported success.main(YBF-MLA): the starter worker written tosrc/index.tsis now wrapped withSentry.withSentry(). Upstream wrote a plain worker with no Sentry.src/index.tswith nomain: the existing file is wrapped instead of being overwritten by the starter worker.wrangler.toml(WHX-UYU): the copy-paste snippet includesmain = "src/index.ts"when the wizard setsmain. Upstream left it out.plugins(UNB-FTW):plugins: existingPluginsorplugins: getPlugins()becomes[...existingPlugins, sentryWebpackPlugin(…)]. Upstream replaced the value and dropped those plugins.undefinedandnullare still replaced.post<deploy>(5YD-7F8): an existingpost<deploy>script is kept, with&& <pm> sentry:sourcemapsadded after it. Upstream overwrote it. It's left alone when it already runssentry:sourcemaps.postscripts, so the upload is chained onto the deploy script (&& yarn sentry:sourcemaps). npm, pnpm, Yarn 1 and Bun keep thepost<deploy>hook.sentry:sourcemaps, the.sentryclircupload target and the auth token, then shows the deploy command to add. Upstream stopped before writing any of them and still reported success.wrangler deploythroughnpx(including-yandwrangler@<version>),pnpx,bunx,pnpm/pnpm exec/pnpm dlx,yarn,bun x,cross-env, or a leadingVAR=valueare now edited. Upstream accepted only a barewrangler deploy.wrangler deploywith the--outdir,--var SENTRY_RELEASE:…and--upload-source-mapsflags. Upstream showed the unchanged script.ValidationErroronce the redirect is accepted. SvelteKit shows up again on its own once its runner lands.Product calls
withSentry: follows the Wrangler install guide and the existing wrap path for configured entry points.post<deploy>hook, merged rather than overwritten: the Wrangler source maps guide uses apostdeployhook, so that stays the default. An existing hook is kept, the way the other flows keep user scripts.&&chaining for Yarn 2+ only: matches how the sentry-cli flow attachessentry:sourcemapsto the build script. Other package managers keep the hook from the docs.npx/pnpm execdeploy commands: the new flags go after thewrangler deploysegment, as they do for a bare command.via @BYK.
--
View Session [Sentry]