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
709 stars 202 forks source link

[BUG] Permission 'cloudfunctions.functions.list' denied #203

Open teebu opened 2 years ago

teebu commented 2 years ago

Action config

- uses: FirebaseExtended/action-hosting-deploy@v0
  with:
    repoToken: "${{ secrets.GITHUB_TOKEN }}"
    firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
    expires: 30d
    projectId: my-awesome-project

Error message

This has been working for years, and now we're starting noticing this error:

"HTTP Error: 403, Permission 'cloudfunctions.functions.list' denied on 'projects/<my-project>/locations/-/functions'"

Expected behavior

Deploy without needed permission.

Actual behavior

Fails to deploy.

robchambers commented 2 years ago

Same here. Looks like firebase-tools introduced some issues ~24h ago with release 10.9.0, and have put out a couple of release fixes since then. Am hoping the problem resolves itself with these fixes. https://github.com/firebase/firebase-tools/releases

teebu commented 2 years ago

To avoid having to wait for the problem to resolve itself, I had to add the permission to the github actions service account.

robchambers commented 2 years ago

yeah... this is still not working for me. And thanks for the note @teebu, but in my case even adding that permission to the github actions service account did not help.

johnnyoshika commented 2 years ago

I'm having the same problem too ☚ī¸

timdebruyn commented 2 years ago

Same problem here... Need to release urgently so waiting for a fix

UgniusSmidtas commented 2 years ago

Same here. Waiting for a fix

johnnyoshika commented 2 years ago

Still seems to be a problem 😔

@teebu How did you add the cloudfunctions.functions.list permission to the service account? Did you have to add the whole roles/cloudfunctions.viewer role?

johnnyoshika commented 2 years ago

I couldn't wait for the fix, so I ended up adding the cloudfunctions.viewer role (aka Cloud Functions Viewer) to the service account and deployment worked

gnu-enjoyer commented 2 years ago

As mentioned above adding cloudfunctions.viewer to the associated GitHub Actions service account resolved the issue.

puskuruk commented 2 years ago

It worked for me as well 🎉

lyndon-bot commented 2 years ago

had the same issue gave the service account a bit of a higher perms of developer, thanks for the help 🎈!!

followyouhome commented 2 years ago

Is it possible to get this fixed w/o permissions update?

maxicano88 commented 2 years ago

Still seems to be a problem 😔

@teebu How did you add the cloudfunctions.functions.list permission to the service account? Did you have to add the whole roles/cloudfunctions.viewer role?

In cloud.google.com click 'IAM & Admin', then look for the principal with 'github-action', hit the pencil to edit, click 'add another role' and add 'cloud functions viewer'. BTW, make sure you're in the right project (i have multiple)

ChrisRoss5 commented 2 years ago

In cloud.google.com click 'IAM & Admin', then look for the principal with 'github-action', hit the pencil to edit, click 'add another role' and add 'cloud functions viewer'. BTW, make sure you're in the right project (i have multiple)

Worked for me! Thanks @maxicano88

MarkJocas commented 2 years ago

Still seems to be a problem pensive @teebu How did you add the cloudfunctions.functions.list permission to the service account? Did you have to add the whole roles/cloudfunctions.viewer role?

In cloud.google.com click 'IAM & Admin', then look for the principal with 'github-action', hit the pencil to edit, click 'add another role' and add 'cloud functions viewer'. BTW, make sure you're in the right project (i have multiple)

Worked for me too. Thanks @maxicano88

fullstack-cognitionteam commented 2 years ago

this thing only appear when using cloud function in hosting

mrsolarius commented 2 years ago

Yes, I have the same issue when try to deploy angular with server-side rendering function.

suresh-jbt commented 2 years ago

Yes, I have the same issue when try to deploy angular with server-side rendering function.

You can follow this to get resolved

https://github.com/FirebaseExtended/action-hosting-deploy/issues/203#issuecomment-1129053273

camnewnham commented 2 years ago

This just cropped up for us as well, including --only hosting

naodya commented 2 years ago

In my case adding "Cloud Functions Viewer" role to the GitHub actions service account helped. The service account name looks something like github-action-<some-number>@<project-id>.iam.gserviceaccount.com

2022-10-05 at 9 39 PM

crystal6117 commented 2 years ago

Google's policy was changed? Yesterday, everything was good, but today I faced such issue. Why this happen?

guanwei-huang commented 2 years ago

same situation, yesterday it was good but seeing this error now. I am using FirebaseExtended/action-hosting-deploy@v0 Adding Cloud Function Viewer role didn't solve my problem.

claytonfaria commented 2 years ago

same situation, yesterday all good, today this error and also adding the Cloud Function Viewer role did not solve the issue

mustafaradheyyan commented 2 years ago

same situation, yesterday it was good but seeing this error now. I am using FirebaseExtended/action-hosting-deploy@v0 Adding Cloud Function Viewer role didn't solve my problem.

I would try making sure you have the "Firebase Hosting Admin" role added as well.

guanwei-huang commented 2 years ago

same situation, yesterday it was good but seeing this error now. I am using FirebaseExtended/action-hosting-deploy@v0 Adding Cloud Function Viewer role didn't solve my problem.

I would try making sure you have the "Firebase Hosting Admin" role added as well.

yes, the runner also has "Firebase Hosting Admin" role in my case.

mustafaradheyyan commented 2 years ago

same situation, yesterday it was good but seeing this error now. I am using FirebaseExtended/action-hosting-deploy@v0 Adding Cloud Function Viewer role didn't solve my problem.

I would try making sure you have the "Firebase Hosting Admin" role added as well.

yes, the runner also has "Firebase Hosting Admin" role in my case.

What is the exact error you are getting? Only about 'cloudfunctions.functions.list' denied?

mustafaradheyyan commented 2 years ago

same situation, yesterday it was good but seeing this error now. I am using FirebaseExtended/action-hosting-deploy@v0 Adding Cloud Function Viewer role didn't solve my problem.

I would try making sure you have the "Firebase Hosting Admin" role added as well.

yes, the runner also has "Firebase Hosting Admin" role in my case.

And are you using firebase-tools@11.14.0?

guanwei-huang commented 2 years ago

I am sure that my google project has enabled cloud function api from day 1. and I double checked. (updated with full logs)

  /opt/hostedtoolcache/node/14.20.1/x64/bin/npx firebase-tools deploy --only hosting:dev --project d**************sh --json
  ***
    "status": "error",
    "error": "Failed to list functions for d**************sh"
  ***
  ***
    "status": "error",
    "error": "Failed to list functions for d**************sh"
  ***

  The process '/opt/hostedtoolcache/node/14.20.1/x64/bin/npx' failed with exit code 1
  Retrying deploy with the --debug flag for better error output
  /opt/hostedtoolcache/node/14.20.1/x64/bin/npx firebase-tools deploy --only hosting:dev --project d**************sh --debug
  [2022-10-06T05:58:48.109Z] > 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"]
  [2022-10-06T05:58:48.248Z] [iam] checking project d**************sh for permissions ["firebase.projects.get","firebasehosting.sites.update"]
  [2022-10-06T05:58:48.251Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/d**************sh:testIamPermissions [none]
  [2022-10-06T05:58:48.251Z] >>> [apiv2][(partial)header] POST https://cloudresourcemanager.googleapis.com/v1/projects/d**************sh:testIamPermissions x-goog-quota-user=projects/d**************sh
  [2022-10-06T05:58:48.252Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/d**************sh:testIamPermissions ***"permissions":["firebase.projects.get","firebasehosting.sites.update"]***
  [2022-10-06T05:58:48.338Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/d**************sh:testIamPermissions 200
  [2022-10-06T05:58:48.339Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/d**************sh:testIamPermissions ***"permissions":["firebase.projects.get","firebasehosting.sites.update"]***
  [2022-10-06T05:58:48.340Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/d**************sh [none]
  [2022-10-06T05:58:48.596Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/d**************sh 200
  [2022-10-06T05:58:48.596Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/d**************sh ***"projectId":"d**************sh","projectNumber":"10************5","displayName":"d**************sh","name":"projects/d**************sh","resources":***"hostingSite":"d**************sh","storageBucket":"d**************sh.appspot.com","locationId":"asia-northeast1"***,"state":"ACTIVE","etag":"1_e163e2c1-0320-417b-954a-8239215e346c"***

  === Deploying to 'd**************sh'...

  i  deploying hosting 
  [2022-10-06T05:58:48.600Z] >>> [apiv2][query] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites/d**************dev/versions [none]
  [2022-10-06T05:58:48.601Z] >>> [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites/d**************dev/versions ***"status":"CREATED","labels":***"deployment-tool":"cli-firebase--action-hosting-deploy"***
  [2022-10-06T05:58:49.020Z] <<< [apiv2][status] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites/d**************dev/versions 200
  [2022-10-06T05:58:49.021Z] <<< [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites/d**************dev/versions ***"name":"projects/10************5/sites/d**************dev/versions/c1d9a597e34af942","status":"CREATED","config":***,"labels":***"deployment-tool":"cli-firebase--action-hosting-deploy"***
  i  hosting[d**************dev]: beginning deploy... 
  i  hosting[d**************dev]: found 17 files in build 
  [2022-10-06T05:58:49.031Z] [hosting] uploading with 200 concurrency
  [2022-10-06T05:58:49.035Z] [hosting] hash cache [YnVpbGQ] stored for 17 files
  [2022-10-06T05:58:49.035Z] [hosting][hash queue][FINAL] ***"max":1,"min":0,"avg":0,"active":0,"complete":17,"success":17,"errored":0,"retried":0,"total":17,"elapsed":3***
  [2022-10-06T05:58:49.036Z] >>> [apiv2][query] POST https://firebasehosting.googleapis.com/v1beta1/projects/10************5/sites/d**************dev/versions/c1d9a597e34af942:populateFiles [none]
  [2022-10-06T05:58:49.036Z] >>> [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/10************5/sites/d**************dev/versions/c1d9a597e34af942:populateFiles ***"files":***"/asset-manifest.json":"e588d5342832d1b9ee335d4cfb7b2cc2c21dc848a1a3ccf1dc6e08f931dd2f7d","/favicon.jpg":"fa08c4842c46072382dff1f7a40cf7b5b4e4617ce4f75700a795dff8adc77b0f","/index.html":"71503fa57446ee44c217bfca70ed2bd6146b47b5d44aa9e5ae00da2a7c9ea4d2","/manifest.json":"ed7b98046be74c7d1476b73ebb8cd1f00c2b34443af1525af60b9dd20be9fb9a","/precache-manifest.f4213c02d9141be19b286e6f92c0478b.js":"c4348dcaa26b2391fcec0f3db2f1b5a0d86d3e2a9432b3b2938ebe019c8b2ab1","/service-worker.js":"901a68a8247fc9b7e49f1265ad5171f76b705965fedbf5de80bea94b34937628","/static/css/2.711ab2c1.chunk.css":"c6000ced03ce87f99badc5f7b66ddfb58d0f87109f3afe06b6c10cc39c0c477e","/static/css/2.711ab2c1.chunk.css.map":"09f08f39451e76a6e8c1bda9e3e46f3641bbe4dc4eddb3f3ba260485d5ff7ae2","/static/css/main.85d559f8.chunk.css":"6d2002ea2929ff84cf537f2196465fcc9f05ce7e3495315635bb1e6d911d3922","/static/css/main.85d559f8.chunk.css.map":"b459b97c79329f29e24337de6fc5a9014f8f53f448e6815057e378a1d6a11c67","/static/js/2.2d8a88f3.chunk.js":"a0bc324432400f62f545ea605a3eef04a5eb629ad4893c2260c5189f759c2dcd","/static/js/2.2d8a88f3.chunk.js.map":"54c85100f3cb96698436d0d06401acce275d61a889a86d2fb5a2f8e9cfa7b71e","/static/js/main.b8fb52c9.chunk.js":"86748c7e7a1f9dfe3c32de8d246611359cd31bc4646a42d94c4eff3a94a56cad","/static/js/main.b8fb52c9.chunk.js.map":"050aa47ae124cd49f0fbe4315fe2e70449e0c69554a560e5c236fd4678a25297","/static/js/runtime~main.a8a9905a.js":"5b0313db8c475761662a933e703f2a6bd16847cdfc34b81915f5dd56862e4e77","/static/js/runtime~main.a8a9905a.js.map":"2510643041ce395196dfc3f9ae31cd72d7127dbd8457479959c6e22dd1b1eaeb","/static/media/loading-spinner.c9ba0bee.svg":"b337680905f2cf39df2b249d146803f4247db5055536dfda87172c4d65f4532e"***
  [2022-10-06T05:58:49.520Z] <<< [apiv2][status] POST https://firebasehosting.googleapis.com/v1beta1/projects/10************5/sites/d**************dev/versions/c1d9a597e34af942:populateFiles 200
  [2022-10-06T05:58:49.520Z] <<< [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/10************5/sites/d**************dev/versions/c1d9a597e34af942:populateFiles ***"uploadUrl":"https://upload-firebasehosting.googleapis.com/upload/sites/d**************dev/versions/c1d9a597e34af942/files"***
  [2022-10-06T05:58:49.521Z] [hosting][populate queue][FINAL] ***"max":487,"min":487,"avg":487,"active":0,"complete":1,"success":1,"errored":0,"retried":0,"total":1,"elapsed":487***
  [2022-10-06T05:58:49.521Z] [hosting] uploads queued: 0
  [2022-10-06T05:58:49.521Z] [hosting][upload queue][FINAL] ***"max":0,"min":9999999999,"avg":0,"active":0,"complete":0,"success":0,"errored":0,"retried":0,"total":0,"elapsed":1665035929521***
  i  hosting: upload complete 
  ✔  hosting[d**************dev]: file upload complete 
  [2022-10-06T05:58:49.522Z] [hosting] deploy completed after 499ms
  [2022-10-06T05:58:49.523Z] [
    ***
      "config": ***
        "target": "dev",
        "public": "build",
        "ignore": [
          "firebase.json",
          "**/.*",
          "**/node_modules/**"
        ],
        "rewrites": [
          ***
            "source": "**",
            "destination": "/index.html"
          ***
        ],
        "site": "d**************dev"
      ***,
      "version": "projects/10************5/sites/d**************dev/versions/c1d9a597e34af942"
    ***
  ]
  i  hosting[d**************dev]: finalizing version... 
  [2022-10-06T05:58:49.524Z] >>> [apiv2][query] GET https://cloudfunctions.googleapis.com/v1/projects/d**************sh/locations/-/functions [none]
  [2022-10-06T05:58:49.583Z] <<< [apiv2][status] GET https://cloudfunctions.googleapis.com/v1/projects/d**************sh/locations/-/functions 403
  [2022-10-06T05:58:49.584Z] <<< [apiv2][body] GET https://cloudfunctions.googleapis.com/v1/projects/d**************sh/locations/-/functions ***"error":***"code":403,"message":"Cloud Functions API has not been used in project 10************5 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudfunctions.googleapis.com/overview?project=10************5 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.","status":"PERMISSION_DENIED","details":[***"@type":"type.googleapis.com/google.rpc.Help","links":[***"description":"Google developers console API activation","url":"https://console.developers.google.com/apis/api/cloudfunctions.googleapis.com/overview?project=10************5"***]***,***"@type":"type.googleapis.com/google.rpc.ErrorInfo","reason":"SERVICE_DISABLED","domain":"googleapis.com","metadata":***"consumer":"projects/10************5","service":"cloudfunctions.googleapis.com"***]***
  [2022-10-06T05:58:49.586Z] [functions] failed to list functions for d**************sh
  [2022-10-06T05:58:49.586Z] [functions] HTTP Error: 403, Cloud Functions API has not been used in project 10************5 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudfunctions.googleapis.com/overview?project=10************5 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
  [2022-10-06T05:58:49.588Z] FirebaseError: HTTP Error: 403, Cloud Functions API has not been used in project 10************5 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudfunctions.googleapis.com/overview?project=10************5 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
      at responseToError (/home/runner/.npm/_npx/1833/lib/node_modules/firebase-tools/lib/responseToError.js:49:12)
      at RetryOperation._fn (/home/runner/.npm/_npx/1833/lib/node_modules/firebase-tools/lib/apiv2.js:288:77)
      at processTicksAndRejections (internal/process/task_queues.js:95:5)

  Error: Failed to list functions for d**************sh
  [2022-10-06T05:58:51.193Z] Error when notifying about new CLI updates:

  [2022-10-06T05:58:48.109Z] > 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"]
  [2022-10-06T05:58:48.248Z] [iam] checking project d**************sh for permissions ["firebase.projects.get","firebasehosting.sites.update"]
  [2022-10-06T05:58:48.251Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/d**************sh:testIamPermissions [none]
  [2022-10-06T05:58:48.251Z] >>> [apiv2][(partial)header] POST https://cloudresourcemanager.googleapis.com/v1/projects/d**************sh:testIamPermissions x-goog-quota-user=projects/d**************sh
  [2022-10-06T05:58:48.252Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/d**************sh:testIamPermissions ***"permissions":["firebase.projects.get","firebasehosting.sites.update"]***
  [2022-10-06T05:58:48.338Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/d**************sh:testIamPermissions 200
  [2022-10-06T05:58:48.339Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/d**************sh:testIamPermissions ***"permissions":["firebase.projects.get","firebasehosting.sites.update"]***
  [2022-10-06T05:58:48.340Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/d**************sh [none]
  [2022-10-06T05:58:48.596Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/d**************sh 200
  [2022-10-06T05:58:48.596Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/d**************sh ***"projectId":"d**************sh","projectNumber":"10************5","displayName":"d**************sh","name":"projects/d**************sh","resources":***"hostingSite":"d**************sh","storageBucket":"d**************sh.appspot.com","locationId":"asia-northeast1"***,"state":"ACTIVE","etag":"1_e163e2c1-0320-417b-954a-8239215e346c"***

  === Deploying to 'd**************sh'...

  i  deploying hosting 
  [2022-10-06T05:58:48.600Z] >>> [apiv2][query] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites/d**************dev/versions [none]
  [2022-10-06T05:58:48.601Z] >>> [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites/d**************dev/versions ***"status":"CREATED","labels":***"deployment-tool":"cli-firebase--action-hosting-deploy"***
  [2022-10-06T05:58:49.020Z] <<< [apiv2][status] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites/d**************dev/versions 200
  [2022-10-06T05:58:49.021Z] <<< [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites/d**************dev/versions ***"name":"projects/10************5/sites/d**************dev/versions/c1d9a597e34af942","status":"CREATED","config":***,"labels":***"deployment-tool":"cli-firebase--action-hosting-deploy"***
  i  hosting[d**************dev]: beginning deploy... 
  i  hosting[d**************dev]: found 17 files in build 
  [2022-10-06T05:58:49.031Z] [hosting] uploading with 200 concurrency
  [2022-10-06T05:58:49.035Z] [hosting] hash cache [YnVpbGQ] stored for 17 files
  [2022-10-06T05:58:49.035Z] [hosting][hash queue][FINAL] ***"max":1,"min":0,"avg":0,"active":0,"complete":17,"success":17,"errored":0,"retried":0,"total":17,"elapsed":3***
  [2022-10-06T05:58:49.036Z] >>> [apiv2][query] POST https://firebasehosting.googleapis.com/v1beta1/projects/10************5/sites/d**************dev/versions/c1d9a597e34af942:populateFiles [none]
  [2022-10-06T05:58:49.036Z] >>> [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/10************5/sites/d**************dev/versions/c1d9a597e34af942:populateFiles ***"files":***"/asset-manifest.json":"e588d5342832d1b9ee335d4cfb7b2cc2c21dc848a1a3ccf1dc6e08f931dd2f7d","/favicon.jpg":"fa08c4842c46072382dff1f7a40cf7b5b4e4617ce4f75700a795dff8adc77b0f","/index.html":"71503fa57446ee44c217bfca70ed2bd6146b47b5d44aa9e5ae00da2a7c9ea4d2","/manifest.json":"ed7b98046be74c7d1476b73ebb8cd1f00c2b34443af1525af60b9dd20be9fb9a","/precache-manifest.f4213c02d9141be19b286e6f92c0478b.js":"c4348dcaa26b2391fcec0f3db2f1b5a0d86d3e2a9432b3b2938ebe019c8b2ab1","/service-worker.js":"901a68a8247fc9b7e49f1265ad5171f76b705965fedbf5de80bea94b34937628","/static/css/2.711ab2c1.chunk.css":"c6000ced03ce87f99badc5f7b66ddfb58d0f87109f3afe06b6c10cc39c0c477e","/static/css/2.711ab2c1.chunk.css.map":"09f08f39451e76a6e8c1bda9e3e46f3641bbe4dc4eddb3f3ba260485d5ff7ae2","/static/css/main.85d559f8.chunk.css":"6d2002ea2929ff84cf537f2196465fcc9f05ce7e3495315635bb1e6d911d3922","/static/css/main.85d559f8.chunk.css.map":"b459b97c79329f29e24337de6fc5a9014f8f53f448e6815057e378a1d6a11c67","/static/js/2.2d8a88f3.chunk.js":"a0bc324432400f62f545ea605a3eef04a5eb629ad4893c2260c5189f759c2dcd","/static/js/2.2d8a88f3.chunk.js.map":"54c85100f3cb96698436d0d06401acce275d61a889a86d2fb5a2f8e9cfa7b71e","/static/js/main.b8fb52c9.chunk.js":"86748c7e7a1f9dfe3c32de8d246611359cd31bc4646a42d94c4eff3a94a56cad","/static/js/main.b8fb52c9.chunk.js.map":"050aa47ae124cd49f0fbe4315fe2e70449e0c69554a560e5c236fd4678a25297","/static/js/runtime~main.a8a9905a.js":"5b0313db8c475761662a933e703f2a6bd16847cdfc34b81915f5dd56862e4e77","/static/js/runtime~main.a8a9905a.js.map":"2510643041ce395196dfc3f9ae31cd72d7127dbd8457479959c6e22dd1b1eaeb","/static/media/loading-spinner.c9ba0bee.svg":"b337680905f2cf39df2b249d146803f4247db5055536dfda87172c4d65f4532e"***
  [2022-10-06T05:58:49.520Z] <<< [apiv2][status] POST https://firebasehosting.googleapis.com/v1beta1/projects/10************5/sites/d**************dev/versions/c1d9a597e34af942:populateFiles 200
  [2022-10-06T05:58:49.520Z] <<< [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/10************5/sites/d**************dev/versions/c1d9a597e34af942:populateFiles ***"uploadUrl":"https://upload-firebasehosting.googleapis.com/upload/sites/d**************dev/versions/c1d9a597e34af942/files"***
  [2022-10-06T05:58:49.521Z] [hosting][populate queue][FINAL] ***"max":487,"min":487,"avg":487,"active":0,"complete":1,"success":1,"errored":0,"retried":0,"total":1,"elapsed":487***
  [2022-10-06T05:58:49.521Z] [hosting] uploads queued: 0
  [2022-10-06T05:58:49.521Z] [hosting][upload queue][FINAL] ***"max":0,"min":9999999999,"avg":0,"active":0,"complete":0,"success":0,"errored":0,"retried":0,"total":0,"elapsed":1665035929521***
  i  hosting: upload complete 
  ✔  hosting[d**************dev]: file upload complete 
  [2022-10-06T05:58:49.522Z] [hosting] deploy completed after 499ms
  [2022-10-06T05:58:49.523Z] [
    ***
      "config": ***
        "target": "dev",
        "public": "build",
        "ignore": [
          "firebase.json",
          "**/.*",
          "**/node_modules/**"
        ],
        "rewrites": [
          ***
            "source": "**",
            "destination": "/index.html"
          ***
        ],
        "site": "d**************dev"
      ***,
      "version": "projects/10************5/sites/d**************dev/versions/c1d9a597e34af942"
    ***
  ]
  i  hosting[d**************dev]: finalizing version... 
  [2022-10-06T05:58:49.524Z] >>> [apiv2][query] GET https://cloudfunctions.googleapis.com/v1/projects/d**************sh/locations/-/functions [none]
  [2022-10-06T05:58:49.583Z] <<< [apiv2][status] GET https://cloudfunctions.googleapis.com/v1/projects/d**************sh/locations/-/functions 403
  [2022-10-06T05:58:49.584Z] <<< [apiv2][body] GET https://cloudfunctions.googleapis.com/v1/projects/d**************sh/locations/-/functions ***"error":***"code":403,"message":"Cloud Functions API has not been used in project 10************5 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudfunctions.googleapis.com/overview?project=10************5 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.","status":"PERMISSION_DENIED","details":[***"@type":"type.googleapis.com/google.rpc.Help","links":[***"description":"Google developers console API activation","url":"https://console.developers.google.com/apis/api/cloudfunctions.googleapis.com/overview?project=10************5"***]***,***"@type":"type.googleapis.com/google.rpc.ErrorInfo","reason":"SERVICE_DISABLED","domain":"googleapis.com","metadata":***"consumer":"projects/10************5","service":"cloudfunctions.googleapis.com"***]***
  [2022-10-06T05:58:49.586Z] [functions] failed to list functions for d**************sh
  [2022-10-06T05:58:49.586Z] [functions] HTTP Error: 403, Cloud Functions API has not been used in project 10************5 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudfunctions.googleapis.com/overview?project=10************5 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
  [2022-10-06T05:58:49.588Z] FirebaseError: HTTP Error: 403, Cloud Functions API has not been used in project 10************5 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudfunctions.googleapis.com/overview?project=10************5 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
      at responseToError (/home/runner/.npm/_npx/1833/lib/node_modules/firebase-tools/lib/responseToError.js:49:12)
      at RetryOperation._fn (/home/runner/.npm/_npx/1833/lib/node_modules/firebase-tools/lib/apiv2.js:288:77)
      at processTicksAndRejections (internal/process/task_queues.js:95:5)

  Error: Failed to list functions for d**************sh
  [2022-10-06T05:58:51.193Z] Error when notifying about new CLI updates:

  The process '/opt/hostedtoolcache/node/14.20.1/x64/bin/npx' failed with exit code 1
  Error: The process '/opt/hostedtoolcache/node/14.20.1/x64/bin/npx' failed with exit code 1
  ***
    conclusion: 'failure',
    output: ***
      title: 'Deploy preview failed',
      summary: "Error: The process '/opt/hostedtoolcache/node/14.20.1/x64/bin/npx' failed with exit code 1"
    ***
  ***
guanwei-huang commented 2 years ago

And are you using firebase-tools@11.14.0?

where could I check the version of it?

mustafaradheyyan commented 2 years ago

And are you using firebase-tools@11.14.0?

where could I check the version of it?

I think if you have it installed via package.json it will be listed there, otherwise Github Actions would automatically install it for you and therefore it would probably install the latest version automatically.

Which would be listed under "Run FirebaseExtended/action-hosting-deploy@v0" > "Deploying to Firebase preview channel".

claytonfaria commented 2 years ago

in our case, it is now working again after deleting one function that had failed to deploy a few Months ago (we were not using that function anyway)

that was weird, since we did not do anything different from yesterday till now

check https://console.cloud.google.com/functions/list

hariharan-tendercuts commented 2 years ago

Adding Cloud Function Viewer role didn't solve my problem.

Same here. Adding Cloud Function Viewer role didn't solve the issue.

hitima commented 2 years ago

The same Issue occurred again today. I think it is when firebase-tools installed with github actions was upgraded from 11.13.0 to 11.14.0.

In my case, I solved the problem by granting the service account of github actions the permission to view the functions. But strangely enough, the functions are not used in my project.

coadan commented 2 years ago

What worked for us was adding Cloud Functions Viewer role to all the associated github service accounts and enabled the Cloud Functions API.

guanwei-huang commented 2 years ago

And are you using firebase-tools@11.14.0?

where could I check the version of it?

I think if you have it installed via package.json it will be listed there, otherwise Github Actions would automatically install it for you and therefore it would probably install the latest version automatically.

Which would be listed under "Run FirebaseExtended/action-hosting-deploy@v0" > "Deploying to Firebase preview channel".

@mustafaradheyy sorry for the late reply, Github Action didn't print firebase-tools version for me but I will try to lock the version by adding it to my package.json and see if I get different results from 11.13.0 and 11.14.0.

hariharan-tendercuts commented 2 years ago

What worked for us was adding Cloud Functions Viewer role to all the associated github service accounts and enabled the Cloud Functions API.

After enabling cloud functions API, it worked

niklabh commented 2 years ago

Why hosting need functions permission. Please fix.

vasani-arpit commented 2 years ago

In my case adding just a role didn't do anything. I had to open the link which was suggested in error message which redirected me to API and services section of that project in GCP and I searched and added a new service named google cloud functions

Klaitos commented 2 years ago

See my comment https://github.com/firebase/firebase-tools/issues/5071 for workaround

romk1n commented 2 years ago

same issue on our side

yevhen-carv commented 2 years ago

Same problem. Even recreating the Service Account with recteating the service keys didn't help (even fresh firebase init hosting doesn't help).

aitorch commented 2 years ago

Same here. enabling cloudfunctions.googleapis.com in the project and adding roles/cloudfunctions.viewer to the service account works for me

oyvindwe commented 2 years ago

Same here. enabling cloudfunctions.googleapis.com in the project and adding roles/cloudfunctions.viewer to the service account works for me

This worked for us as well.

TheBay0r commented 2 years ago

@mustafaradheyy sorry for the late reply, Github Action didn't print firebase-tools version for me but I will try to lock the version by adding it to my package.json and see if I get different results from 11.13.0 and 11.14.0.

Since I didn't want to give the service account more permissions I tried pinning the version to 11.13.0 (using npm install --save-dev firebase-tools@11.13.0 for the project).

So far the best workaround for me.

mu-irfan commented 1 year ago

Still seems to be a problem 😔 @teebu How did you add the cloudfunctions.functions.list permission to the service account? Did you have to add the whole roles/cloudfunctions.viewer role?

In cloud.google.com click 'IAM & Admin', then look for the principal with 'github-action', hit the pencil to edit, click 'add another role' and add 'cloud functions viewer'. BTW, make sure you're in the right project (i have multiple)

I am unable to find principal with 'github-action',

Screenshot 2023-05-24 at 1 23 28 PM

error i faced:

Screenshot 2023-05-24 at 1 24 22 PM

help me out with this error.