sentry-cli icon indicating copy to clipboard operation
sentry-cli copied to clipboard

Upload Sourcemaps not working for multiple project in same release

Open cre8 opened this issue 2 years ago • 6 comments

Environment

"@sentry/cli": "^2.7.0",

Steps to Reproduce

I have an NX project where I got two angular applications and two nestjs applications. Each of them has a task like:

    "sentry-release": {
      "executor": "nx:run-commands",
      "options": {
        "commands": [
          "npm run sentry-cli -- releases new $(npm --silent run sentry-cli releases propose-version) -o trustcerts -p trust-signer-frontend --auth-token={args.SENTRY_AUTH_TOKEN}",
          "npm run sentry-cli -- releases set-commits --auto $(npm --silent run sentry-cli releases propose-version) -o trustcerts -p trust-signer-frontend --auth-token={args.SENTRY_AUTH_TOKEN}",
          "npm run sentry-cli -- releases files $(npm --silent run sentry-cli releases propose-version) upload-sourcemaps dist/apps/trust-signer -o trustcerts -p trust-signer-frontend --auth-token={args.SENTRY_AUTH_TOKEN}",
          "npm run sentry-cli -- releases finalize $(npm --silent run sentry-cli releases propose-version) -o trustcerts -p trust-signer-frontend --auth-token={args.SENTRY_AUTH_TOKEN}"
        ],
        "parallel": false
      }
    },

with a different project and sourmap path. In the ci job I see that each job runs successfully like

> sentry-cli releases files 8bc8d35a2e3dba03426b19dc0aa04db34304beda upload-sourcemaps dist/apps/trust-signer-backend -o trustcerts -p trust-singer-backend --auth-token=***

> Found 2 release files
> Analyzing 2 sources
> Rewriting sources
> Adding source map references
> Bundled 2 files for upload
> Uploaded release files to Sentry
> File upload complete (processing pending on server)
> Organization: trustcerts
> Project: trust-singer-backend
> Release: 8bc8d35a2e3dba03426b19dc0aa04db34304beda
> Dist: None

Source Map Upload Report
  Scripts
    ~/main.js
  Source Maps
    ~/main.js.map

> [email protected] sentry-cli
> sentry-cli releases finalize 8bc8d35a2e3dba03426b19dc0aa04db34304beda -o trustcerts -p trust-singer-backend --auth-token=***

Finalized release 8bc8d35a2e3dba03426b19dc0aa04db34304beda

Expected Result

When I upload the source files with a reference to a project I assume that each project has its dedicated source maps in one release (so source maps from two projects are not mixed together)

Actual Result

But in the end I get all files together in one: image

So all souremaps are merged or overwritten in one folder. And it is not possible for sentry to get the correct map files.

As a workaround I would add a prefix to each release like the project, so I get a unique release identifier for each job. But this will increase the amount of releases and has no easy mapping between the commit hash and the release id.

cre8 avatar Feb 25 '23 16:02 cre8

That's quite odd, it should be indeed assigned to the specific project. Can you run the CI with SENTRY_LOG_LEVEL=debug env? It should give you logs with all the requests sent to Sentry, and it should tell us the whole store.

kamilogorek avatar Feb 25 '23 16:02 kamilogorek

Added the loggs as attachments since they are over 3k lines: sentry-log.txt

when going through them I see the chunk upload multiple times Bundled <amount> files for upload I got 64, 19, 12, 2, 2, 2, 2, 2 for the value when it gets uploaded, summed up it is 105. But the release in sentry shows 96: image I think since some files are named the same they get overwritten so it's 96 and not 105

when I add a prefix to each release it works, see: image

Looking through the logs I see that I gave a wrong name for the "trust-signer-backend project when addressing the cli, but this should be the error why all the other projects are sharing the same 96 artifcats.

cre8 avatar Feb 27 '23 10:02 cre8

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar Mar 21 '23 00:03 github-actions[bot]

@kamilogorek could you find and specific in the logs?

cre8 avatar Apr 07 '23 18:04 cre8

Sorry for the bot, I missed the issue. I see there are plenty of 208 responses from the server, and wonder if this is due to the fact that you use the same release name for every project (which shouldn't be the issue as they are indeed scoped). There should be a clear separation organization -> project -> release -> files. I'm leaving for longer break Today so wont be able to help much right now, but we're doing some work around how source maps work now, so will try to get back to this once I'm back.

kamilogorek avatar Apr 11 '23 10:04 kamilogorek

All right, I will make a reminder in my calendar for some weeks so look at the problem again

cre8 avatar Apr 12 '23 07:04 cre8

@cre8 Are you still experiencing this issue?

szokeasaurusrex avatar Mar 19 '24 13:03 szokeasaurusrex

@szokeasaurusrex I haven't looked at this again because we changed our handling. Since I cannot give more information for this, this issue can be closed.

cre8 avatar Mar 19 '24 13:03 cre8