Skip to content

Precedence of SENTRY_AUTH_TOKEN locations #2420

Open
@constantinius

Description

@constantinius

CLI Version

2.42.2 2.37.0

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

15.3.1 (24D70)

Link to reproduction repository

No response

CLI Command

sentry-cli sourcemaps upload --org ORG_B --project PROJ_B ./dist

Exact Reproduction Steps

  1. Login to ORG_A using the sentry-cli
  2. Use the wizard to set up sourcemaps for a project. In the process, login to ORG_B
  3. Confirm that a SENTRY_AUTH_TOKEN was created for that org (ORG_B) and saved to .env.sentry-build-plugin. (either use b64decode or look for that token in the org development settings)
  4. Try to upload sourcemaps using sentry-cli sourcemaps upload --org ORG_B --project PROJ_B ./dist.

Expected Results

I expect the sentry-cli to use the token contained within the project (in the .env.sentry-build-plugin) or a way to directly specify the token contained.

Actual Results

It seems the sentry-cli uses the global token.

Logs

  WARN    2025-03-20 11:22:51.574001 +01:00 Using organization `ORG_A` (embedded in token) rather than manually-configured organization `ORG_B`. To use `ORG_B`, please provide an auth token for this organization.
> Found 4 files
> Analyzing 4 sources
> Analyzing completed in 0.002s
> Rewriting sources
> Rewriting completed in 0.016s
> Adding source map references
> Bundling completed in 0.045s
> Bundled 4 files for upload
> Bundle ID: ...
> Optimizing completed in 0.001s
error: API request failed

Caused by:
    sentry reported an error: One or more projects are invalid (http status: 400)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

      Participants

      @constantinius

      Issue actions

        Precedence of `SENTRY_AUTH_TOKEN` locations · Issue #2420 · getsentry/sentry-cli