Skip to content

MSBuild integration fails the build when no Sentry auth token is available #5704

Closed

Description

@jamescrosswell

Problem

With SentryUploadSymbols, SentryUploadSources or SentryCreateRelease enabled, a build with no Sentry auth token fails:

EXEC : error : Auth token is required for this request. Please run `sentry-cli login` and try again!
  The Sentry CLI is not fully configured with authentication, organization, and project.
Build FAILED.

That covers every build without a token: fork PRs (GitHub withholds secrets from them), contributors' local Release builds, and docker build without the secret mounted. Today the only way out is to know to pass /p:UseSentryCLI=false. SENTRY_ALLOW_FAILURE=true doesn't help.

An invalid or expired token, or an unreachable server, fails the same way. The targets emit "Sentry API request failed" as a warning for that case, but the build has already failed.

The JS bundler plugins warn and skip the upload in this situation. Our targets were written to do the same thing: PrepareSentryCLI probes with sentry-cli info and, on a non-zero exit, prints "not fully configured" and clears $(SentryCLI), which skips every upload and release target. That part still works, but by then the build has already failed.

Cause

The probe's Exec sets IgnoreExitCode="true" but not IgnoreStandardErrorWarningFormat="true". Since sentry-cli 2.30.0, info prints error: Auth token is required… (or error: API request failed), and MSBuild treats that as a build error. Up to 2.28.6 it exited 1 without printing anything. I checked every bundled CLI from 2.17.5 to 3.8.0: this has been broken since the CLI bump in #3203, i.e. since 4.2.0.

The integration tests miss it because RunDotnetWithSentryCLI (integration-test/common.ps1) always passes /p:SentryAuthToken=dummy.

Repro

<SentryOrg>org</SentryOrg>
<SentryProject>project</SentryProject>
<SentryUploadSymbols>true</SentryUploadSymbols>
HOME=$(mktemp -d) dotnet build -c Release   # empty HOME so ~/.sentryclirc isn't picked up

Proposal

  1. Add IgnoreStandardErrorWarningFormat="true" to the sentry-cli info probe in PrepareSentryCLI. With 6.9.0's targets patched this way, the repro builds and nothing is uploaded.
  2. Say what was skipped, like the bundler plugins do, and keep the CLI's raw error: output out of the default console verbosity so it doesn't read as a failure.
  3. Add integration tests for no token and for an invalid token that assert the build succeeds and nothing is uploaded.

Keep the skip as a high-importance message, not a <Warning>. A warning would fail builds that use -warnaserror or MSBuildTreatWarningsAsErrors, which is the same bug again.

Activity

  1. linear-code commented on Oct 11, 2026

    @linear-code
  2. added a commit that references this issue on Oct 12, 2026
    deada1c
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

    BugSomething isn't workingMSBuild

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions