Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve @sentry/wizard -i sourcemaps for Cloudflare/Wrangler #824

Open
timkelty opened this issue Feb 24, 2025 · 1 comment
Open

Improve @sentry/wizard -i sourcemaps for Cloudflare/Wrangler #824

timkelty opened this issue Feb 24, 2025 · 1 comment

Comments

@timkelty
Copy link

timkelty commented Feb 24, 2025

Problem Statement

The docs point you to @sentry/wizard -i sourcemaps when setting up Cloudflare + sourcemaps.

If you're using wrangler's default bundler, that doesn't help you much:

  • It asks you for an output directory, when wrangler will build to .wrangler/tmp/bundle-{hash} by default.
  • It also asks for a "production build command", which most boilerplates don't have (the simply have "deploy": "wrangler deploy", which takes an --env arg)

Related: getsentry/sentry-javascript#14841

Solution Brainstorm

If you're using the default bundler, you really need to be using --outdir ./dist so sentry CLI knows where to look.

Also, rather than tacking on npm run sentry:sourcemaps, I think using NPM's Pre & Post Scripts would be a better choice, eg:

{
  "scripts": {
    "deploy": "wrangler deploy --outdir ./dist",
    "postdeploy": "npm run sentry:sourcemaps",
    "sentry:sourcemaps": "sentry-cli sourcemaps inject ./dist && sentry-cli sourcemaps upload ./dist"
  }
}

This would allow people to still run npm deploy -- --env=production and have sourcemaps uploaded.

Even better than that, would be to get Cloudflare to expand their custom builds config, so you could do something after a build and not just before.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Feb 24, 2025
@timkelty timkelty changed the title Imporve @sentry/wizard -i sourcemaps for Cloudflare Improve @sentry/wizard -i sourcemaps for Cloudflare Feb 24, 2025
@timkelty timkelty changed the title Improve @sentry/wizard -i sourcemaps for Cloudflare Improve @sentry/wizard -i sourcemaps for Cloudflare (Wrangler) Feb 24, 2025
@timkelty timkelty changed the title Improve @sentry/wizard -i sourcemaps for Cloudflare (Wrangler) Improve @sentry/wizard -i sourcemaps for Cloudflare/Wrangler Feb 24, 2025
@Lms24
Copy link
Member

Lms24 commented Feb 25, 2025

Hi, thanks for writing in!

If you're using the default bundler, you really need to be using --outdir ./dist so sentry CLI knows where to look.

This is valuable information, thanks a lot! cc @AbhiPrasad maybe this solves getsentry/sentry-javascript#14841 if this will be our recommended approach for CloudFlare going forward, I think we can definitely create a new source maps wizard flow for CF.

I think using NPM's Pre & Post Scripts would be a better choice

IIRC we discussed this when working on the source map wizards flow a while ago and there were concerns due to package manager compatibility. But maybe we can revisit this.

I'll transfer this issue to the wizard repo in the meantime. Thanks for your suggestions!

@Lms24 Lms24 transferred this issue from getsentry/sentry-javascript Feb 25, 2025
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants