firebase-android-sdk icon indicating copy to clipboard operation
firebase-android-sdk copied to clipboard

firebaseAppDistribution doesn't supply quota project when using ADC with user account

Open breathe opened this issue 9 months ago • 2 comments

Describe your environment

  • Android Studio version: 2024.2.2 Patch 2
  • Firebase Component: AppDistribution (gradle plugin)
  • Component version: id 'com.google.firebase.appdistribution' version '5.1.1' apply false

Describe the problem

  • gradle plugin fails to determine or communicate the quota project
  • appdistribution api rejects the request with 403

Steps to reproduce:

# ensure firebase cli is not logged in because plugin will use those creds if they exist (you'll be unable to reproduce from a machine with (old-style) firebase cli login creds in place!)
rm ~/.config/configstore/firebase-tools.json

# ensure logged into ADC
gcloud auth application-default login

# ensure quota project set
gcloud auth application-default set-quota-project PROJ

# gradle build
env GOOGLE_APPLICATION_CREDENTIALS=/Users/<redact>/.config/gcloud/application_default_credentials.json ./gradlew --console plain --no-daemon assembleFullDebug uploadCrashlyticsSymbolFileFullDebug appDistributionUploadFullDebug --debug --stacktrace

There are several successful network transactions in the logs and then this (looks like while trying to see operation status)

2025-02-27T04:49:45.323-0700 [INFO] [com.google.api.client.http.HttpTransport] -------------- REQUEST  --------------
GET https://firebaseappdistribution.googleapis.com/v1/projects/PROJECT_NUMBER/apps/1:PROJECT_NUMBER:android:<redact>/releases/-/operations/<redact>
Accept-Encoding: gzip
Authorization: <Not Logged>
User-Agent: Firebase App Distro Client/5.1.1
x-client-version: gradle/5.1.1

2025-02-27T04:49:45.367-0700 [INFO] [com.google.api.client.http.HttpTransport] Total: 1,153 bytes
2025-02-27T04:49:45.367-0700 [INFO] [com.google.api.client.http.HttpTransport] {
  "error": {
    "code": 403,
    "message": "Your application is authenticating by using local Application Default Credentials. The firebaseappdistribution.googleapis.com API requires a quota project, which is not set by default. To learn how to set your quota project, see https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds .",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "SERVICE_DISABLED",
        "domain": "googleapis.com",
        "metadata": {
          "consumer": "projects/764086051850",
          "service": "firebaseappdistribution.googleapis.com"
        }
      },
      {
        "@type": "type.googleapis.com/google.rpc.LocalizedMessage",
        "locale": "en-US",
        "message": "Your application is authenticating by using local Application Default Credentials. The firebaseappdistribution.googleapis.com API requires a quota project, which is not set by default. To learn how to set your quota project, see https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds ."
      }
    ]
  }
}

Relevant Code:

  • gradle deploy as above works if I log into firebase ci with legacy FIREBASE_TOKEN
  • same deploy works with firebase cli -- with firebase cli's implementation of ADC

breathe avatar Feb 27 '25 11:02 breathe

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Feb 27 '25 11:02 google-oss-bot

Hi @breathe, thank you for reaching out. I was able to reproduce the behavior you raised. I’ll raise this to our engineers and see what we can do here.Thanks!

lehcar09 avatar Mar 03 '25 16:03 lehcar09