Repository navigation
Closed
Description
Due to the new Firebase warning:
⚠ Authenticating with
--tokenis deprecated and will be removed in a future major version offirebase-tools. Instead, use a service account key withGOOGLE_APPLICATION_CREDENTIALS: https://cloud.google.com/docs/authentication/getting-started
We decided to implement it as it should be.
[REQUIRED] Environment info
firebase-tools: 11.18.0
Platform: Github Actions with ubuntu-latest and pnpm.
[REQUIRED] Test case
name: Deploy to Firebase Hosting on merge
'on':
push:
branches:
- main
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 7.18.2
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Run tests
run: pnpm test:unit
- name: Run build
run: pnpm build
- name: Install Functions Deps
shell: bash
run: |
cd functions && pnpm i
# Future code for deploying without token
- name: Decoding base64 Credentials
shell: bash
run: echo ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_BASE64 }} | base64 --decode > credentials.json
- name: Save credentials into environment variables
run: echo "GOOGLE_APPLICATION_CREDENTIALS=./credentials.json" >> $GITHUB_ENV
- name: Deploy to Firebase
shell: bash
# Using GOOGLE_APPLICATION_CREDENTIALS env
run: |
./node_modules/.bin/firebase deploy --non-interactive
- name: Remove credentials file
if: success() || failure()
run: rm credentials.json[REQUIRED] Steps to reproduce
- Generate the service account from the Firebase project.
- Encode it into base64, save it in Github secrets as GOOGLE_APPLICATION_CREDENTIALS_BASE64.
- Push anything to
mainbranch.
[REQUIRED] Expected behavior
Firebase should deploy as expected.

Activity
google-oss-bot commentedon Dec 15, 2022
This issue does not seem to follow the issue template. Make sure you provide all the required information.
christhompsongoogle commentedon Dec 20, 2022
Can you share your firebase json? which products are you deploying? This looks like a permissions issue
bkendall commentedon Dec 20, 2022
hey @JFGHT - would you be able to check the permissions that the SA has? I think by default it has 0 permissions, so it'll have to have some added to it. You can confirm the permissions issue by running with
--debugas well and checking that output.JFGHT commentedon Dec 21, 2022
Nice debugging log.
I added those manually and then I got this:
Enabled the API
Then I got this:
Added it and threw the same error.
Added it to the generated SA and this error from above was gone but stiil:
Without any other sign of specific error.
JFGHT commentedon Jan 13, 2023
Hey @bkendall, any news on this?
emilbonnek commentedon Feb 15, 2023
I had the same issue it got resolved for me by adding Cloud Run Admin and Service Account User to the SA as suggested here.
mkue commentedon Jun 6, 2023
I ran into the same issue when running:
I managed to resolve the same issue by adding the Firebase Rules Admin and Firebase Rules Firestore Service Agent roles to the service account.
mwilliams1188 commentedon Sep 29, 2023
I can deploy locally using firebase deploy, but GitHub action is throwing this error: "Caller is missing permission 'iam.serviceaccounts.actAs' on service account [email protected]".
It says add server account user, which I did. I also added Cloud Run Admin and I'm getting the same error no matter what permission I add.
I'm using the webframeworks experiment (SvelteKit). I used firebase init (using the latest firebase-tools) which set all the configuration and created the service account, so all the configuration is default.
Any idea what could be wrong here?
Update: Seems like adding Cloud Run Service Agent resolved this, though the error doesn't make that clear
robokozo commentedon Oct 13, 2023
@mwilliams1188 I tried the same but I'm still encountering the same issue. The only difference is I'm trying to do the same with a nuxt webframeworks experiment :(
Can you think of any other steps you might have taken to resolve it? I actually granted the account "Owner" permissions but without any luck. (I removed it after I verified it wasn't working)
JFGHT commentedon Dec 12, 2023
@joehan Why was this closed? could you link a ref to the solution?
ndpdarshana commentedon Dec 12, 2023
@joehan The solution is to create a service account and generate a service account key from the Google Cloud console, which can then be used to deploy Firebase.
One key is generated, set the
GOOGLE_APPLICATION_CREDENTIALSenvironment variable to the generated key file which will automatically used by firebase tools to deploy the project.https://stackoverflow.com/questions/59053919/login-to-firebase-using-gcloud-service-account
johnnyoshika commentedon Dec 27, 2023
Is there a list of all permissions needed by the service account to deploy each Firebase service?