getsentry / sentry-android-gradle-plugin

Gradle plugin for Sentry Android. Upload proguard, debug files, and more.

Home Page:https://docs.sentry.io/platforms/android/gradle/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error logs about missing cli auth token after updated to 4.5

G00fY2 opened this issue · comments

Gradle Version

8.7

AGP Version

8.3.2

Code Minifier/Optimizer

None

Version

4.5

Sentry SDK Version

7.8.0

Steps to Reproduce

  • Add Sentry Android Gradle plugin to project
  • Configure the sentry plugin with ignoredBuildTypes.set(setOf("debug"))
  • Do not install or setup the Sentry CLI
  • run assembleDebug to build an Android project

Expected Result

Since the build type is ignored no sentry CLI task is executed and no Sentry errors are logged

Actual Result

We always see an Gradle error log with (the build luckily still succeeds)

Auth token is required for this request. Please run sentry-cli login and try again!

Facing the same issue. The error is thrown from sentry-cli as described in 2.29.0 release notes. The error shows up when building app variants that don't have anything to do with sentry, which suggests that sentry is doing something unneeded under the hood.

Same issue
Has anyone come up with a workaround for this yet?

Hi everyone, thanks for reaching out!
I just tried to reproduce(same Gradle, AGP and sentry Gradle plugin versions) this quickly, but unfortunately couldn't.

Could you share a few more details about your setup?

  1. A snippet of your sentry { } .gradle config
  2. Are you using the new EU region?

Additionally our telemetry could be the root cause, as it utilizes sentry-cli under the hood. You can disable it via the configuration block and try if it works then.

sentry {
    telemetry.set(false)
}

Additionally you can enable debugging an run your gradle task with the --info flags to get more details about the tasks being executed.

sentry {
    debug.set(true)
}

telemetry.set(false) does not work : (
That's a reproducible sample log:
https://github.com/flipperdevices/Flipper-Android-App/actions/runs/8887106408/job/24401803084?pr=840#step:4:11306

This branch with the command ./gradlew assembleInternal.

Actually the error log is gone after configuring telemetry.set(false)! Maybe it makes sense to only try sending telemetry if the auth token is available?

For me it seems like this was executed while configuration phase. Because the error message was always very early in the logs, right after the Android variants got configured.

@LionZXY Maybe you have autoUploadProguardMapping enabled locally? We currently configured it like this autoUploadProguardMapping.set(isCI).

Thanks for all the details, I can finally reproduce the issue. It looks like a recent sentry-cli version bump is the underlying issue, causing requests to be made when they shouldn't. the --no-upload flag to be ignored.

We're on it!

Quick update: We shipped a bugfix with our 4.5.1 release. Please give it a try and let us know if the issue is resolved for you as well.

Re-opening this issue as we see error logs in the gradle build which are causing some confusion (Note: the build still succeeds).

@markushi I was also getting the same issue on 4.5.1 but it got resolved by disabling telemetry.

@markushi I was also getting the same issue on 4.5.1 but it got resolved by disabling telemetry.

Same.

Same here with 4.5.1. According to the Gradle debug logs calling sentry-cli info already warns about the missing auth token:

2024-05-13T18:46:07.022+0200 [INFO] [org.gradle.process.internal.DefaultExecHandle] Starting process 'command '/Users/dev/android/app/build/tmp/sentry-cli-2.31.1.exe''. Working directory: /Users/dev/android Command: /Users/dev/android/app/build/tmp/sentry-cli-2.31.1.exe --log-level=error info
2024-05-13T18:46:07.022+0200 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTING
2024-05-13T18:46:07.022+0200 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Waiting until process started: command '/Users/dev/android/app/build/tmp/sentry-cli-2.31.1.exe'.
2024-05-13T18:46:07.025+0200 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTED
2024-05-13T18:46:07.026+0200 [DEBUG] [org.gradle.process.internal.ExecHandleRunner] waiting until streams are handled...
2024-05-13T18:46:07.026+0200 [INFO] [org.gradle.process.internal.DefaultExecHandle] Successfully started process 'command '/Users/dev/android/app/build/tmp/sentry-cli-2.31.1.exe''
2024-05-13T18:46:07.038+0200 [ERROR] [system.err] error: Auth token is required for this request. Please run `sentry-cli login` and try again!
2024-05-13T18:46:07.038+0200 [ERROR] [system.err]
2024-05-13T18:46:07.038+0200 [ERROR] [system.err] Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
2024-05-13T18:46:07.038+0200 [ERROR] [system.err] Please attach the full debug log to all bug reports.
2024-05-13T18:46:07.038+0200 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: FAILED
2024-05-13T18:46:07.038+0200 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Process 'command '/Users/dev/android/app/build/tmp/sentry-cli-2.31.1.exe'' finished with exit value 1 (state: FAILED)