sentry-android-gradle-plugin icon indicating copy to clipboard operation
sentry-android-gradle-plugin copied to clipboard

Error logs about missing cli auth token after updated to 4.5

Open G00fY2 opened this issue 9 months ago • 10 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!

G00fY2 avatar Apr 25 '24 14:04 G00fY2

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.

tjohnn avatar Apr 26 '24 14:04 tjohnn

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

LionZXY avatar Apr 29 '24 15:04 LionZXY

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)
}

markushi avatar Apr 29 '24 16:04 markushi

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.

LionZXY avatar Apr 30 '24 00:04 LionZXY

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).

G00fY2 avatar Apr 30 '24 07:04 G00fY2

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!

markushi avatar Apr 30 '24 08:04 markushi

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.

markushi avatar May 01 '24 06:05 markushi

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

markushi avatar May 08 '24 13:05 markushi

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

tjohnn avatar May 08 '24 17:05 tjohnn

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

Same.

bfricka avatar May 08 '24 19:05 bfricka

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)

sebokopter avatar May 13 '24 17:05 sebokopter

I believe this should be tackled by #708 now

romtsn avatar May 16 '24 08:05 romtsn

hey everyone here, the issue has been addressed in the version 4.6.0, which just has been published. Please give it a try and let us know. Thank you!

romtsn avatar May 16 '24 09:05 romtsn