Open aseem-heg opened 1 year ago
For me it fails with Error: Failed to get details for project: <PROJECT_NAME>
. My service account also has all the necessary permissions. Could these be related?
Same
Facing the same issue, the service account has all the necessary permission but still i am getting this error, but
Same. I'm wondering if the credentials secret should be the whole JSON from the service account or maybe just the key.
Hi there,
I've come across the issue you're facing and found a solution that worked for me. The problem seems to be related to authentication with Google Cloud Platform (GCP) credentials when deploying to Firebase using GitHub Actions. Here's how I resolved it:
On your local machine, run firebase login
. This will authenticate your Firebase CLI and give you a token. Please ensure you're logged into the correct Firebase project.
You'll receive a token that looks something like this: 1//03MosCTldCCgYIARPPGAMSTkF-L2IrO-W55quB6Pwn6w1335SwtTSXYbGGxleferiRdVSXTUL1x7QUkJaTKEGW-WaVpYFpSJK
(Do not use this one as it's an example).
Convert this token to base64. You can use an online tool like https://www.base64encode.org/ for this purpose.
Next, go to the environment variables section of your GitHub repository by navigating to Settings -> Secrets and variables -> Actions -> New repository secret. Create two new repository secret named GCP_SA_KEY
and GCP_SA_KEY_BASE64
paste the base64-encoded token you obtained as its value in this last one. The plain token in the GCP_SA_KEY
.
Modify your GitHub Actions YAML file to use this token for authentication with Firebase. Here's how the updated part of your workflow should look:
# Deploying the functions to firebase
- name: Deploy to Firebase
uses: w9jds/firebase-action@master
with:
args: deploy --only functions --token ${{ secrets.GCP_SA_KEY }}
env:
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY_BASE64 }}
I hope this solution works for you as well. Good luck!
Not sure if anyone still has this problem, but using personal token with GitHub Actions didn't seem very secure, and the actual issue was with permissions for the service account.
I got it fixed by granting access to "run as" the App Engine default Service Account"([PROJECT_ID]@appspot.gserviceaccount.com)
.
These roles and permissions did the trick for me:
Just putting it out there in case someone else runs into the same hurdle.
I am trying to deploy flutter app to Firebase. Deployment works fine from my local machine. But on GHA I get error
Error: Failed to get Firebase project <project_name>. Please make sure the project exists and your account has permission to access it
My GCP sv_account has permissions -
Firebase Hosting Admin
&Service Account User
.