Skip to content

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented May 21, 2025

This PR adds a Cloudflare Wrangler tool flow to the source maps wizard. Because wrangler doesn't allow us to inject debug ids after build and before deployment, we have to resort to our release-based legacy upload strategy.

Therefore, this setup flow needs to do the following things:

  • install Sentry CLI
  • modify the wrangler deploy npm script to
    • determine the release value from sentry-cli releases propose-version
    • access source maps by setting the --outdir arg
    • inject the SENTRY_RELEASE environment variable
    • add the --upload-source-maps arg so that we can guarantee that source maps are emitted into the outdir
  • add a sentry:sourcemaps npm script that
    • determines the release value from sentry-cli releases propose-version
    • creates a new release
    • uploads source maps for the new release
  • add a postdeploy script that invokes the sentry:sourcemaps script
  • create a .sentryclirc file and .gitignore it

Additionally, because of the release based stuff, I decided to show a note at the beginning that this setup is a bit limited and more complicated and we'd generally recommend using the CF Vite plugin + the vite sourcemaps wizard flow.

Example:

Screen.Recording.2025-05-21.at.14.32.59.mov

(note in this video, the wizard is only permanently installed because that's the easiest way to run it locally)

I'll add an e2e test but probably in a different PR because I wanna try something out to simplify the e2e tests

closes #824

Copy link

github-actions bot commented May 21, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 5512b56

Copy link

codecov bot commented May 21, 2025

Codecov Report

Attention: Patch coverage is 29.04290% with 215 lines in your changes missing coverage. Please review.

Project coverage is 27.98%. Comparing base (68da106) to head (5512b56).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/sourcemaps/tools/wrangler.ts 29.16% 204 Missing ⚠️
src/sourcemaps/sourcemaps-wizard.ts 8.33% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #999      +/-   ##
==========================================
+ Coverage   27.96%   27.98%   +0.02%     
==========================================
  Files         129      130       +1     
  Lines       13930    14233     +303     
  Branches      856      882      +26     
==========================================
+ Hits         3895     3983      +88     
- Misses      10018    10233     +215     
  Partials       17       17              
Flag Coverage Δ
unit-tests 27.98% <29.04%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Lms24 Lms24 force-pushed the lms/feat-cf-wrangler-sourcemaps-wizard branch from c7107cb to 25656cb Compare May 21, 2025 12:29
@Lms24 Lms24 self-assigned this May 21, 2025
@Lms24 Lms24 requested review from AbhiPrasad, a team and chargome and removed request for a team May 21, 2025 12:46
@Lms24 Lms24 marked this pull request as ready for review May 21, 2025 12:51
@Lms24 Lms24 force-pushed the lms/feat-cf-wrangler-sourcemaps-wizard branch from 0559287 to b0ad164 Compare May 30, 2025 14:59
@Lms24 Lms24 requested a review from AbhiPrasad May 30, 2025 15:14
@Lms24 Lms24 merged commit afb2704 into master Jun 2, 2025
72 of 73 checks passed
@Lms24 Lms24 deleted the lms/feat-cf-wrangler-sourcemaps-wizard branch June 2, 2025 08:47
AbhiPrasad added a commit to getsentry/sentry-docs that referenced this pull request Jun 24, 2025
Documents the changes from
getsentry/sentry-wizard#999

ref getsentry/sentry-javascript#14841

A new sourcemaps guide for Wrangler was added to the Cloudflare
documentation.

* A new guide,
`docs/platforms/javascript/common/sourcemaps/uploading/wrangler.mdx`,
was created.
* It details both automatic setup via the Sentry Wizard and manual
configuration.
* Manual steps include installing `@sentry/cli`, configuring
`sentry-cli`, and modifying the `package.json` scripts.
* The `deploy` script is updated to include `--outdir`,
`--upload-source-maps`, and `--var SENTRY_RELEASE:$(sentry-cli releases
propose-version)`.
* A `sentry:sourcemaps` script is added to create releases and upload
sourcemaps.
* A `postdeploy` script is introduced to automatically run the
`sentry:sourcemaps` command after deployment.
* Instructions for configuring the Sentry SDK with `release:
env.SENTRY_RELEASE` are provided.
* The guide is marked as `supported: [javascript.cloudflare]` to ensure
platform-specific visibility.
* `platform-includes/sourcemaps/overview/javascript.cloudflare.mdx` was
updated to include a "Cloudflare-Specific Tools" section, linking to the
new Wrangler guide.
* `platform-includes/sourcemaps/upload/primer/javascript.cloudflare.mdx`
was modified to include the updated Cloudflare overview.

These changes ensure that Wrangler users have a dedicated guide for
sourcemap uploads, integrated seamlessly into the Cloudflare platform
documentation.

---------

Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: Alex Krawiec <[email protected]>
bitsandfoxes pushed a commit to getsentry/sentry-docs that referenced this pull request Jul 3, 2025
Documents the changes from
getsentry/sentry-wizard#999

ref getsentry/sentry-javascript#14841

A new sourcemaps guide for Wrangler was added to the Cloudflare
documentation.

* A new guide,
`docs/platforms/javascript/common/sourcemaps/uploading/wrangler.mdx`,
was created.
* It details both automatic setup via the Sentry Wizard and manual
configuration.
* Manual steps include installing `@sentry/cli`, configuring
`sentry-cli`, and modifying the `package.json` scripts.
* The `deploy` script is updated to include `--outdir`,
`--upload-source-maps`, and `--var SENTRY_RELEASE:$(sentry-cli releases
propose-version)`.
* A `sentry:sourcemaps` script is added to create releases and upload
sourcemaps.
* A `postdeploy` script is introduced to automatically run the
`sentry:sourcemaps` command after deployment.
* Instructions for configuring the Sentry SDK with `release:
env.SENTRY_RELEASE` are provided.
* The guide is marked as `supported: [javascript.cloudflare]` to ensure
platform-specific visibility.
* `platform-includes/sourcemaps/overview/javascript.cloudflare.mdx` was
updated to include a "Cloudflare-Specific Tools" section, linking to the
new Wrangler guide.
* `platform-includes/sourcemaps/upload/primer/javascript.cloudflare.mdx`
was modified to include the updated Cloudflare overview.

These changes ensure that Wrangler users have a dedicated guide for
sourcemap uploads, integrated seamlessly into the Cloudflare platform
documentation.

---------

Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: Alex Krawiec <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve @sentry/wizard -i sourcemaps for Cloudflare/Wrangler
3 participants