Skip to content

fix(cli): Warn that the Android wizard's auth token stays on this machine - #2806

Merged
BYK merged 5 commits into
mainfrom
fix/android-wizard-auth-token-warning
Dec 3, 2026
Merged

BYK merged 5 commits into
mainfrom
fix/android-wizard-auth-token-warning

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

This comes from testing sentry wizard android on fresh Android Studio projects (getsentry/sentry-java#6797). The wizard writes the auth token to sentry.properties, adds that file to .gitignore, and turns on includeSourceContext, so every Release build runs sentryUploadSourceBundleRelease. On a teammate's clone, or in CI without SENTRY_AUTH_TOKEN, that task has no token and fails the build, while the wizard ends with "Successfully installed the Sentry Android SDK!". @sentry/wizard behaves the same.

The lasting fix belongs in the Sentry Android Gradle Plugin, which should skip the upload with a warning when there's no token. Until then, the wizard tells the user; what the build does is unchanged:

  • After writing sentry.properties, a warning says the file holds the auth token and is gitignored, so Release builds on other machines fail at the Sentry upload until they have a token. It says to set SENTRY_AUTH_TOKEN in CI (with the org's auth token settings URL) or to have teammates create their own sentry.properties.
  • On self-hosted Sentry the file also holds the server URL, so the warning and the outro also say to set SENTRY_URL in CI.
  • With the DUMMY_AUTH_TOKEN placeholder, the warning says this machine's Release build fails too and shows the settings URL to replace it.
  • The success outro has one extra line about the token for Release builds on other machines and in CI.
  • New telemetry tag auth-token-placeholder.

buildAuthTokenSettingsUrl is extracted from createAuthToken in utils/project-data.ts so both warnings build the URL the same way. The sentry wizard docs fragment gets a short Android note.

Open decision: this stays a draft until the author decides it's ready.

via Antonis Lilis.

--

View Session [Sentry]

…hine

`sentry wizard android` writes the auth token to the gitignored
`sentry.properties`, and with source context on, every Release build
runs the Sentry Gradle plugin's upload tasks. On machines without the
file, those tasks fail the build. After writing the file, warn about
that and say how to provide a token (`SENTRY_AUTH_TOKEN` in CI, or a
`sentry.properties` per machine). With the placeholder token, say that
this machine's Release build fails too and link the token settings page.
The outro gets one line about it, and the `auth-token-placeholder` tag
records which case ran.

`buildAuthTokenSettingsUrl` moves out of `createAuthToken` so both use it.

Co-Authored-By: Antonis Lilis <antonis.lilis@sentry.io>
@vercel

vercel Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cli Ready Ready Preview Dec 3, 2026 7:47am UTC
sentry-local Ready Ready Preview Dec 3, 2026 7:47am UTC

Request Review

@antonis antonis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On self-hosted Sentry, the wizard also writes the server URL to sentry.properties (url: selfHosted ? sentryUrl : undefined), so machines without the file are missing the URL too. When the project is self-hosted, also tell the user to set SENTRY_URL along with SENTRY_AUTH_TOKEN in CI, in both the warning and the outro line. Add a test.

On self-hosted Sentry, sentry.properties also holds the server URL, so
machines without the file need SENTRY_URL along with SENTRY_AUTH_TOKEN.
Say so in the warning and the outro line.
@vercel
vercel Bot temporarily deployed to Preview – sentry-local December 2, 2026 16:20 Inactive
@sentry-junior

sentry-junior Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@antonis Fixed in d6d847a67. On self-hosted projects, the warning now says sentry.properties holds the auth token and the server URL, and tells CI to set SENTRY_URL to the server URL as well as SENTRY_AUTH_TOKEN. The placeholder warning does the same. The outro line names both variables ("need SENTRY_AUTH_TOKEN and SENTRY_URL"). On sentry.io, neither message mentions SENTRY_URL. New tests cover self-hosted with a real token, self-hosted with the placeholder, and sentry.io, and the docs fragment has the same note.

…th-token-warning

# Conflicts:
#	packages/cli/test/lib/wizard/android/android-wizard.test.ts
addSentryCliConfig keeps an auth token that sentry.properties already
has, so this run's token may not be the one in the file. Check the file
for the placeholder instead, and fall back to this run's token only when
the file can't be read.
@BYK
BYK marked this pull request as ready for review December 2, 2026 21:03
@BYK
BYK enabled auto-merge December 2, 2026 21:03
@github-actions github-actions Bot added the risk: low PR risk score: low label Dec 2, 2026
…th-token-warning

Resolve the android-wizard.ts conflict with #2805: keep both PRs'
constants (GRADLE_PLUGIN_DOCS and the CI env vars) and both PRs' helpers
(the token warning helpers and warnGradleCheckFailed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BYK
BYK added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit aafb1e7 Dec 3, 2026
31 checks passed
@BYK
BYK deleted the fix/android-wizard-auth-token-warning branch December 3, 2026 08:02

This branch was successfully deployed

2 active deployments
Preview – sentry-local — 8d2f69ee Deployed Dec 3, 2026 by vercel[bot]
Preview – cli — 8d2f69ee Deployed Dec 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: low PR risk score: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants