Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Failed to get Firebase project <project_name>. Please make sure the project exists and your account has permission to access it #192

Open
aseem-heg opened this issue Jun 19, 2023 · 6 comments

Comments

@aseem-heg
Copy link

    steps:
      - uses: actions/checkout@v3

      - name: Set up Flutter
        uses: subosito/flutter-action@v2
        with:
          channel: 'stable'
          cache: true

      - name: Build Web App
        run: flutter build web --dart-define=env=dev --dart-define=domain=pangea-dev-314501.uc.r.appspot.com

      - name: w9jds Deploy to Firebase
        uses: w9jds/firebase-action@master
        with:
          args: deploy
        env:
          GCP_SA_KEY: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}

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 .

@felixgabler
Copy link

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?

@hotrush
Copy link

hotrush commented Aug 27, 2023

Same

@karanbangia
Copy link

Facing the same issue, the service account has all the necessary permission but still i am getting this error, but

@vincenz5
Copy link

vincenz5 commented Oct 3, 2023

Same. I'm wondering if the credentials secret should be the whole JSON from the service account or maybe just the key.

@peter-palmer
Copy link

peter-palmer commented Mar 11, 2024

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:

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

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

  3. Convert this token to base64. You can use an online tool like https://www.base64encode.org/ for this purpose.

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

  5. 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 }}
  1. Save your changes and rerun your GitHub Actions workflow. This should resolve the issue and successfully deploy your Flutter app to Firebase.

I hope this solution works for you as well. Good luck!

@aixaCode
Copy link

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:

Screenshot 2024-03-12 223103
Screenshot 2024-03-12 223134

Just putting it out there in case someone else runs into the same hurdle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants