I am setting up CICD with Github actions and Firebase hosting.
I have two different workflows, one to deploy after a PR and one after a merge.
Both deploy well.
However, after the merge has deployed, I get a blank page and this error:
index-690a584b.js:827 Uncaught FirebaseError: Firebase: Error (auth/invalid-api-key).
at createErrorInternal (index-690a584b.js:827:504)
at _assert (index-690a584b.js:827:559)
at index-690a584b.js:1892:391
at Component.instanceFactory (index-690a584b.js:1892:791)
at Provider.getOrInitializeService (index-690a584b.js:617:2996)
at Provider.initialize (index-690a584b.js:617:2312)
at initializeAuth (index-690a584b.js:857:209)
at getAuth (index-690a584b.js:1907:612)
at index-690a584b.js:3362:11767
This is my github action yaml:
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: actions/setup-node@v3
with:
node-version: '18'
- run: |
cd front
echo "$ENV_DEVELOPMENT" > .env.development
PWD=$(pwd)
npm install
sh -ac ". $PWD/.env.development; npm run build"
env:
ENV_DEVELOPMENT: ${{ secrets.ENV_DEVELOPMENT }}
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
entrypoint: ./front
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_MYCOMPANY_DEV }}'
channelId: live
projectId: mycompany-dev
The only differences to the working action are the name
, the on
conditions when it runs, and the channelId: live
.
I have added the ENV_DEVELOPMENT
variable to Github secrets and it includes all my Firebase variables.
How could I get rid of the error?