Firebase functions deployment: undefined environment datas with Github actions

Viewed 215

I'm trying to set up the GITHUB actions to deploy my firebase functions. The code of the action is:

name: Development Deploy Workflow
'on':
  push:
    branches:
      - develop
jobs:
  backend-deployment:
    name: Backend Development Deployment
    runs-on: ubuntu-latest
    steps:
      - name: Checkout GitHub repository
        uses: actions/checkout@v2
      - name: Install dependencies
        run: npm install 
      - name: Deploy to Firebase Functions
        uses: w9jds/firebase-action@master
        with:
          args: deploy -P development --only functions           
        env:
          GCP_SA_KEY: '${{ secrets.GCP_SA_KEY }}'

When the action runs I get this error:

✔  functions: Finished running predeploy script.
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled

Error: Error occurred while parsing your function triggers.

TypeError: Cannot read property 'private_key' of undefined
    at Object.<anonymous> (/github/workspace/lib/services/Firebase.service.js:29:47)

The line with the code is:

const { private_key } = functions.config().service_account

I don't understand why functions.config() is empty because I can deploy my functions from my local machine without any problem and in three different environments. can anyone help me? Thanks in advance.

0 Answers
Related