FirebaseExtended / action-hosting-deploy

Automatically deploy shareable previews for your Firebase Hosting sites
https://firebase.google.com/docs/hosting/github-integration
Apache License 2.0
695 stars 202 forks source link

[BUG] Workflow deploy step is asking to run firebase login #149

Closed mpapcp closed 3 years ago

mpapcp commented 3 years ago

Action config

The FIREBASE_SA is stored in our vault, we do not have direct access to it in our org. I am able to parse it into a github env and reference it as seen below.

When first setting up the repo, I was able to do a local firebase init, but not run firebase init hosting:github

the .firebaserc contains

{
  "projects": {
    "default": "my-project-id"
  }
}

And the firebase.json contains

  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}
- id: deploy-firebase
  uses: FirebaseExtended/action-hosting-deploy@v0
  with:
    repoToken: "${{ secrets.GITHUB_TOKEN }}"
    firebaseServiceAccount: $FIREBASE_SA   
    projectId: my-project-id
    channelId: live

-->

Error message

Deploying to production site
  /usr/local/bin/npx firebase-tools deploy --only hosting --project my-project-id --json
  {
    "status": "error",
    "error": "Failed to authenticate, have you run \u001b[1mfirebase login\u001b[22m?"
  }
  {
    "status": "error",
    "error": "Failed to authenticate, have you run \u001b[1mfirebase login\u001b[22m?"
  }

  The process '/usr/local/bin/npx' failed with exit code 1
  Retrying deploy with the --debug flag for better error output
  /usr/local/bin/npx firebase-tools deploy --only hosting --project my-project-id --debug
  [2021-08-09T22:58:34.706Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
  [2021-08-09T22:58:34.729Z] SyntaxError: Unexpected token $ in JSON at position 0
      at JSON.parse (<anonymous>)
      at ReadStream.<anonymous> (/home/runner/.npm/_npx/1959/lib/node_modules/firebase-tools/node_modules/google-auth-library/build/src/auth/googleauth.js:335:43)
      at ReadStream.emit (events.js:412:35)
      at ReadStream.emit (domain.js:470:12)
      at endReadableNT (internal/streams/readable.js:1317:12)
      at processTicksAndRejections (internal/process/task_queues.js:82:21)

Expected behavior

Should deploy webapp to Firebase

Actual behavior

step fails, and is asking me to do a firebase login from within the pipeline? Not clear how to resolve this.

mpapcp commented 3 years ago

Please not I also confirmed that the SA has the following permissions

Firebase Authentication Admin
Firebase Hosting Admin
Cloud Run Viewer
API Keys Viewer