firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Build is not getting uploaded to Firebase App Distribution using GOOGLE_APPLICATION_CREDENTIALS

Open jaydeepbhayani opened this issue 1 year ago • 10 comments

REQUIRED] Environment info firebase --version 13.11.2

firebase-tools:

NA

Platform:

Ubuntu

[REQUIRED] Test case curl -sL https://firebase.tools/ | bash

[REQUIRED] Steps to reproduce curl -sL https://firebase.tools/ | bash

[REQUIRED] Expected behavior Everything is installed, as expected and should upload my aab or apk to firebase app distribution.

[REQUIRED] Actual behavior firebase appdistribution:distribute ./app/build/outputs/bundle/qut/app-qut.aab --app *** --release-notes "build name fix" --groups "QUT"

I am not using --token as it is about to deprecate. so using GOOGLE_APPLICATION_CREDENTIALS getting below error

image

NOTE: when use --token it is successfully getting uploaded to Firebase App Distribution

jaydeepbhayani avatar Jun 10 '24 13:06 jaydeepbhayani

Hey @jaydeepbhayani - can you confirm the service account you used for GOOGLE_APPLICATION_CREDENTIALS is from the same project that is linked to your Google Play account?

joehan avatar Jun 11 '24 17:06 joehan

Hey @jaydeepbhayani - can you confirm the service account you used for GOOGLE_APPLICATION_CREDENTIALS is from the same project that is linked to your Google Play account?

Yes, But my issue is not Google Play as of now. as --token is deprecating I am using instead of token GOOGLE_APPLICATION_CREDENTIALS for login and it should upload the build to Firebase but why it is trying to upload it to Google Play? cc: @aalej

jaydeepbhayani avatar Jun 11 '24 19:06 jaydeepbhayani

@joehan Could you please tell me if there is any update on this?

jaydeepbhayani avatar Jun 12 '24 21:06 jaydeepbhayani

Hey @jaydeepbhayani, my guess is the Google Play error is happening because you haven't linked your Firebase app to a Google Play developer account, which is required for uploading AABs to App Distribution: https://support.google.com/firebase/answer/6392038?hl=en

It is weird that it works for you when you use --token though - is it possible that that command is uploading an APK instead of an AAB (which doesn't have the Play requirement)?

Another hypothesis I have is that the credentials you're using in GOOGLE_APPLICATION_CREDENTIALS is either for the wrong project or does not have the right IAM permissions: https://firebase.google.com/docs/app-distribution/android/distribute-cli?apptype=aab#aab-upload-required-permissions

rebehe avatar Jun 20 '24 20:06 rebehe

Hey @jaydeepbhayani, my guess is the Google Play error is happening because you haven't linked your Firebase app to a Google Play developer account, which is required for uploading AABs to App Distribution: https://support.google.com/firebase/answer/6392038?hl=en

It is weird that it works for you when you use --token though - is it possible that that command is uploading an APK instead of an AAB (which doesn't have the Play requirement)?

Another hypothesis I have is that the credentials you're using in GOOGLE_APPLICATION_CREDENTIALS is either for the wrong project or does not have the right IAM permissions: https://firebase.google.com/docs/app-distribution/android/distribute-cli?apptype=aab#aab-upload-required-permissions

@rebehe The thing is my app is not present in google play as I am working on it. Android I have check the permission as I am the owner it is there which are required. Try to achieve Authentication Deprecation Warning upload to Firebase App Distribution not Google Play store. So I believe there is no connection with code require for Google Play as of now.

Attaching two files one is working while other is not working. notworking.txt working.txt

jaydeepbhayani avatar Jun 20 '24 23:06 jaydeepbhayani

Hey @jaydeepbhayani, gotcha. Can you try uploading an APK instead with GOOGLE_APPLICATION_CREDENTIALS? Also, if you have the debug logs for all the cases you mentioned, that would be helpful too (run with --debug).

rebehe avatar Jun 21 '24 18:06 rebehe

Actually, looking at the files you uploaded, it seems like you are uploading an APK file when you run with --token, whereas you're uploading an AAB file when you run with GOOGLE_APPLICATION_CREDENTIALS. My guess is if you use an APK instead with GOOGLE_APPLICATION_CREDENTIALS it will work.

rebehe avatar Jun 21 '24 18:06 rebehe

Actually, looking at the files you uploaded, it seems like you are uploading an APK file when you run with --token, whereas you're uploading an AAB file when you run with GOOGLE_APPLICATION_CREDENTIALS. My guess is if you use an APK instead with GOOGLE_APPLICATION_CREDENTIALS it will work.

@rebehe I have tried to upload apk and it is working fine but with bundle(aab) it is not working. In multi build environment this seem as bug

jaydeepbhayani avatar Jul 03 '24 11:07 jaydeepbhayani

@jaydeepbhayani To make sure I understand the situation, does it also not work with AAB when you use --token? If so, then this is no longer a credentials issue and the error above This project is not linked to a Google account is a valid issue you'll need to address before being able to upload with AABs.

rebehe avatar Jul 03 '24 12:07 rebehe

@jaydeepbhayani To make sure I understand the situation, does it also not work with AAB when you use --token? If so, then this is no longer a credentials issue and the error above This project is not linked to a Google account is a valid issue you'll need to address before being able to upload with AABs.

@rebehe When I use a token everything works perfectly fine whether it is APK or AAB but if I use Google credentials it only works with APK, not with AAB

jaydeepbhayani avatar Jul 03 '24 15:07 jaydeepbhayani

@jaydeepbhayani it is unlikely that the authentication change would yield the Play error you saw, so my guess is the situation you're seeing is masking a different issue.

My best guess at what is happening is that the credentials you use in --token and the credentials you use in GOOGLE_APPLICATION_CREDENTIALS refer to different Firebase projects. My guess is the former is for a Firebase project that has Play linked, and the latter does not.

rebehe avatar Jul 08 '24 11:07 rebehe

@jaydeepbhayani it is unlikely that the authentication change would yield the Play error you saw, so my guess is the situation you're seeing is masking a different issue.

My best guess at what is happening is that the credentials you use in --token and the credentials you use in GOOGLE_APPLICATION_CREDENTIALS refer to different Firebase projects. My guess is the former is for a Firebase project that has Play linked, and the latter does not.

@rebehe I got your point. See in my case, what I am doing is I have 3 build varients with applicationIdSuffix .dev, .qut and one which is in production. All 3 are under one firebase project.

jaydeepbhayani avatar Jul 08 '24 12:07 jaydeepbhayani

Hi @jaydeepbhayani

Based on going through the comments, and your debug files, it indicates that there's a difference in which binary (either APK, or AAB) is being uploaded with different login methods/accounts.

Can you try reproducing the issue locally - using firebase:login - with the same account associated with the GOOGLE_APPLICATION_CREDENTIALS you're facing the issue with - with the APK, and the AAB?

As @rebehe mentioned earlier - if the issue only arises with the AAB, and not the APK, then the issue is most likely related to this - as uploading an AAB requires linking the Firebase/Google Cloud account to Google Play.

tejasd avatar Jul 09 '24 18:07 tejasd

Hi @jaydeepbhayani

Based on going through the comments, and your debug files, it indicates that there's a difference in which binary (either APK, or AAB) is being uploaded with different login methods/accounts.

Can you try reproducing the issue locally - using firebase:login - with the same account associated with the GOOGLE_APPLICATION_CREDENTIALS you're facing the issue with - with the APK, and the AAB?

As @rebehe mentioned earlier - if the issue only arises with the AAB, and not the APK, then the issue is most likely related to this - as uploading an AAB requires linking the Firebase/Google Cloud account to Google Play.

@tejasd @rebehe I have test locally it works with --token and GOOGLE_APPLICATION_CREDENTIALS both works fine when we are uploading APK but when we upload AAB then it is saying project is not linked with Google Play Store. Now for this case I have 3 ENV under same firebase project DEV, QA and PROD. So it is obvious that PROD is linked with Google Play Store while other two are not.

jaydeepbhayani avatar Jul 17 '24 18:07 jaydeepbhayani