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

upload-sourcemaps “bad reference to source” Error After Angular 19 Update #2372

Open
1 of 8 tasks
andreialecu opened this issue Jan 27, 2025 · 8 comments
Open
1 of 8 tasks

Comments

@andreialecu
Copy link

andreialecu commented Jan 27, 2025

CLI Version

2.41.1

Operating System and Architecture

  • macOS (arm64)
  • macOS (x86_64)
  • Linux (i686)
  • Linux (x86_64)
  • Linux (armv7)
  • Linux (aarch64)
  • Windows (i686)
  • Windows (x86_64)

Operating System Version

macOS 14.6.1

Link to reproduction repository

No response

CLI Command

COMMIT_HASH=$(git rev-parse HEAD) sentry-cli releases -o <organization-name> -p <project-name> files $COMMIT_HASH upload-sourcemaps <build-directory>

Exact Reproduction Steps

After upgrading to Angular 19 and running our build scripts it appears that the step to upload-sourcemaps using the sentry-cli fails with just:

> Found 287 files
> Analyzing 287 sources
> Analyzing completed in 0.063s
> Rewriting sources
error: bad reference to source #8

I cannot see more details about this even if I enable logging, and I cannot share the repo as it's not public.

Expected Results

The Sentry CLI successfully uploads the source maps without any errors.

Actual Results

The Sentry CLI fails during the analysis and rewriting phase with the error:

error: bad reference to source #8

Logs

  DEBUG   2025-01-27 11:01:25.315104 +02:00 whitelisting builds/asdf/chunk-5AVHIDNV.js.map: Whitelist(IgnoreMatch(Types(Glob(Matched { def: FileTypeDef { name: "map", globs: ["*.map"] } }))))  (from ignore)
  INFO    2025-01-27 11:01:25.315137 +02:00 found: builds/asdf/chunk-5AVHIDNV.js.map (187487 bytes)
  DEBUG   2025-01-27 11:01:25.315247 +02:00 whitelisting builds/asdf/chunk-JULAKFHO.js: Whitelist(IgnoreMatch(Types(Glob(Matched { def: FileTypeDef { name: "js", globs: ["*.js"] } }))))  (from ignore)
  INFO    2025-01-27 11:01:25.315261 +02:00 found: builds/asdf/chunk-JULAKFHO.js (1179 bytes)
> Found 287 files
> Analyzing 287 sources
> Analyzing completed in 0.063s
> Rewriting sources
error: bad reference to source #8
  INFO    2025-01-27 11:01:25.793425 +02:00 Skipping update nagger update check
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Jan 27, 2025
@andreialecu
Copy link
Author

Adding --no-rewrite seems to make the command not error out.

Haven't yet verified if it actually makes the sourcemaps work properly in Sentry though.

@andreiborza
Copy link
Member

Hi @andreialecu, thanks for filing this.

Another user reported this on discord, they mentioned tracing this issue back to esbuild's 0.24.1 release. We're still investigating, but for the meantime, if you're using esbuild, could you try downgrading it to 0.24.0?

@scomans
Copy link

scomans commented Jan 27, 2025

Hi @andreialecu, thanks for filing this.

Another user reported this on discord, they mentioned tracing this issue back to esbuild's 0.24.1 release. We're still investigating, but for the meantime, if you're using esbuild, could you try downgrading it to 0.24.0?

If you are using PNPM you can pin the version of esbuild like this:

  "pnpm": {
    "overrides": {
      "@angular/build>[email protected]": "0.24.0"
    }
  }

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Jan 27, 2025
@andreialecu
Copy link
Author

Thank you for the fast turnaround. I'm using Yarn, and added a resolution to 0.24.0

I can confirm that it indeed works with esbuild 0.24.0

@andreiborza
Copy link
Member

Thanks for taking the time to file this and for finding the workaround @scomans.

We'll have to do some digging on this one.

@loewenheim
Copy link
Contributor

One problem here is definitely that there is no indication which sourcemap file was being processed when the error happened. cc @szokeasaurusrex

@szokeasaurusrex
Copy link
Member

Indeed @loewenheim. I've been looking into how to improve our error messages for things like this, so hopefully we can improve behavior here, as well

@kle-pra
Copy link

kle-pra commented Jan 29, 2025

Same problems on our angular 19 project, but suprisingly not all of them.

For npm, the workaround is:

"overrides": {
    "@angular/build": {
      "esbuild": "0.24.0"
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

6 participants