Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to deploy to hosting with 'Failed to list functions for project' error #5071

Closed
miketako3 opened this issue Oct 6, 2022 · 25 comments · Fixed by #5077 or #5111
Closed

Failed to deploy to hosting with 'Failed to list functions for project' error #5071

miketako3 opened this issue Oct 6, 2022 · 25 comments · Fixed by #5077 or #5111
Assignees

Comments

@miketako3
Copy link

[REQUIRED] Environment info

firebase-tools: 11.14.0

Platform: macOS with M1 chip

[REQUIRED] Test case

I just updated firebase-tools from 11.13.0 to 11.14.0 and exec deploy command.

Then following error occurred.

$ firebase deploy

=== Deploying to 'project'...

i  deploying hosting
i  hosting[project]: beginning deploy...
i  hosting[project]: found 101 files in out
✔  hosting[project]: file upload complete
i  hosting[project]: finalizing version...

Error: Failed to list functions for project

[REQUIRED] Steps to reproduce

Same above.

[REQUIRED] Expected behavior

The deploy sequence will be completed.

[REQUIRED] Actual behavior

The error occurred.

Because I don't use cloud functions, I think this is a bug.

Thank you.

@miketako3 miketako3 added the bug label Oct 6, 2022
@miketako3
Copy link
Author

debug log when it runned in Github Actions via FirebaseExtended/action-hosting-deploy

https://github.com/FirebaseExtended/action-hosting-deploy

[2022-10-06T02:04:03.522Z] [functions] HTTP Error: 403, Cloud Functions API has not been used in project XXXXXX before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudfunctions.googleapis.com/overview?project=XXXXXX then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

It is also occurred from local Mac.

@felipepitol
Copy link

Same here.

@p5aholic
Copy link

p5aholic commented Oct 6, 2022

Same here.
I got the error message below when I try to deploy to firebase hosting using this.
https://github.com/FirebaseExtended/action-hosting-deploy

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

I‘m not using cloud functions.

@drummerjolev
Copy link

+1, same error and not using cloud functions. Occuring with Github Actions, for deploying code on PR and on merge to Firebase Hosting.

@ErikCoup
Copy link

ErikCoup commented Oct 6, 2022

We face the same issue when trying to deploy to Firebase Hosting on a PR or on merge using GitHub actions. The logs include the lines:

npm WARN exec The following package was not found and will be installed: firebase-tools@11.14.0
...
***
  "status": "error",
  "error": "HTTP Error: 403, Permission 'cloudfunctions.functions.list' denied on 'projects/<redacted>/locations/-/functions'"
***

@Klaitos
Copy link

Klaitos commented Oct 6, 2022

If someone need to fix it asap, you can reproduce what i did on my org forked version appchoose/action-hosting-deploy@e63a636 and then use your own version waiting for a fix on firebase side.
(aka replace your workflow by - uses: appchoose/action-hosting-deploy@main). I do recommend to fork on your side and do not use mine.

@httnn
Copy link

httnn commented Oct 6, 2022

this worked for me as a quick workaround:
FirebaseExtended/action-hosting-deploy#203 (comment)

@osasanchezme
Copy link

osasanchezme commented Oct 6, 2022

Same here. @Klaitos solution worked perfectly 💪

@jeroldcuico
Copy link

a simple workaround for me is I tried to downgrade to the previous version

npm uninstall -g firebase-tools
npm install -g firebase-tools@11.13.0

and it works..

@steveoh
Copy link
Contributor

steveoh commented Oct 6, 2022

I notice others are seeing this when running firebase deploy, I thought it would be helpful to note that this also happens when specifically only trying to deploy to hosting. firebase deploy --only hosting

@seanburlington
Copy link

a simple workaround for me is I tried to downgrade to the previous version

npm uninstall -g firebase-tools npm install -g firebase-tools@11.13.0

Works for me too

I have no functions on this project - it is a very simple static site and I didn't want to mess around with IAM creating permissions for something that doesn't exist

I hope a fix will be out soon and I can upgrade again

@felipepitol
Copy link

a simple workaround for me is I tried to downgrade to the previous version

npm uninstall -g firebase-tools npm install -g firebase-tools@11.13.0

and it works..

Awesome, this work for me too.

Thank you.

@bkendall bkendall self-assigned this Oct 6, 2022
@bkendall
Copy link
Contributor

bkendall commented Oct 6, 2022

Thanks for raising. I'm taking a look.

@bkendall
Copy link
Contributor

bkendall commented Oct 6, 2022

Alright - I got this narrowed down and the PR above should fix it. We'll get a build out today.

@drummerjolev
Copy link

Thanks for the support @bkendall!

@mikelehen
Copy link
Contributor

FYI- This regression broke several of our projects that I had set up with automatic github deploys using the https://firebase.google.com/docs/hosting/github-integration docs.

While I had a suspicion that the latest firebase-tools release was the cause, there was no trivial way to revert to a working version, since the github action always uses the latest version (https://github.com/FirebaseExtended/action-hosting-deploy/blob/0f248036885ae672f78587669fa2923f0ef6cac2/src/deploy.ts#L79).

And so our deploys have just been broken on multiple projects for 20+ hours. For comparison, we also use vercel for some of our projects, and it's never had a hiccup on this order of magnitude.

I've opened FirebaseExtended/action-hosting-deploy#242 to suggest that the github action pins to a known-good version of firebase-tools, but I'm curious if it would be feasible / reasonable to add some CI checks and/or pre-release checklist steps to firebase-tools that just test that "firebase deploy" works fine on a vanilla free firebase project?

Thank you kindly!

@rodolfogoulart
Copy link

a simple workaround for me is I tried to downgrade to the previous version

npm uninstall -g firebase-tools npm install -g firebase-tools@11.13.0

and it works..

Worked for me this, after updating deploy to hosting was broken

@Satosh-J
Copy link

Satosh-J commented Oct 7, 2022

image

In the packages.json dependency list.

added "firebase-tools" for version 11.13.0 and it worked for me.

@johnnyasantoss
Copy link

johnnyasantoss commented Oct 10, 2022

#5072 (comment)

@bkendall This error still happens on the latest version

$ firebase -V
11.14.1

The log on this comment #5072 (comment) should help assess what's going on.

The error happens after the log finalizing version...

@bkendall
Copy link
Contributor

@johnnyasantoss can you provide a new --debug log for us?

@johnnyasantoss
Copy link

yep

firebase deploy log
$ firebase deploy --only hosting -m '...' --debug
[2022-10-10T16:25:10.073Z] > 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-10T16:25:10.074Z] > authorizing via signed-in user (johnnyadsantos@gmail.com)
[2022-10-10T16:25:10.075Z] [iam] checking project my-project for permissions ["firebase.projects.get","firebasehosting.sites.update"]
[2022-10-10T16:25:10.078Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project:testIamPermissions [none]
[2022-10-10T16:25:10.078Z] >>> [apiv2][(partial)header] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project:testIamPermissions x-goog-quota-user=projects/my-project
[2022-10-10T16:25:10.079Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project:testIamPermissions {"permissions":["firebase.projects.get","firebasehosting.sites.update"]}
[2022-10-10T16:25:11.079Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project:testIamPermissions 200
[2022-10-10T16:25:11.079Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/my-project:testIamPermissions {"permissions":["firebase.projects.get","firebasehosting.sites.update"]}
[2022-10-10T16:25:11.082Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/my-project [none]
[2022-10-10T16:25:12.126Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/my-project 200
[2022-10-10T16:25:12.126Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/my-project {"projectId":"my-project","projectNumber":"1234","displayName":"site Staging","name":"projects/my-project","resources":{"hostingSite":"my-project","storageBucket":"my-project.appspot.com","locationId":"southamerica-east1"},"state":"ACTIVE","etag":"1_67e259bf-e621-4c8c-9a2f-33e368140fa8"}

=== Deploying to 'my-project'...

i  deploying hosting
Running command: yarn just ci
[...]
✔  hosting[admin]: Finished running predeploy script.
[2022-10-10T16:25:52.896Z] >>> [apiv2][query] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites/my-site/versions [none]
[2022-10-10T16:25:52.897Z] >>> [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites/my-site/versions {"status":"CREATED","labels":{"deployment-tool":"cli-firebase"}}
[2022-10-10T16:25:54.218Z] <<< [apiv2][status] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites/my-site/versions 200
[2022-10-10T16:25:54.218Z] <<< [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/-/sites/my-site/versions {"name":"projects/1234/sites/my-site/versions/fc834813ce5333b5","status":"CREATED","config":{},"labels":{"deployment-tool":"cli-firebase"}}
i  hosting[my-site]: beginning deploy...
i  hosting[my-site]: found 16 files in build
[2022-10-10T16:25:54.229Z] [hosting] uploading with 200 concurrency
i  hosting: hashing files [15/16] (93%)
[2022-10-10T16:25:56.621Z] [hosting] hash cache [YnVpbGQ] stored for 16 files
[2022-10-10T16:25:56.621Z] [hosting][hash queue][FINAL] {"max":2384,"min":8,"avg":176.9375,"active":0,"complete":16,"success":16,"errored":0,"retried":0,"total":16,"elapsed":2391}
[2022-10-10T16:25:56.622Z] >>> [apiv2][query] POST https://firebasehosting.googleapis.com/v1beta1/projects/1234/sites/my-site/versions/fc834813ce5333b5:populateFiles [none]
[2022-10-10T16:25:56.622Z] >>> [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/1234/sites/my-site/versions/fc834813ce5333b5:populateFiles {"files":{"/asset-manifest.json":"d8857a93d2f4e12b28c8b5d504ad7c6162220e57d3a1745c0c3c714279325c6e","/favicon.ico":"6886ceb013d7ca4e641a456c10028915d205e18900b372b785439f4554437612","/index.html":"dc6164510c45b19a130775f5d7a4975efd79056348bde2caa42e5a25587cf633","/logo192.png":"eda68b7d01be0146ded68dc0d6aa6517a67eb2031b57d4139134d1dd6aafced9","/manifest.json":"3ed25c0ec8961b0a7e65e673844dd986027310eb1daef53c88acc8d0eaf285ca","/robots.txt":"26800670d64dda89a7bca495a34f0f7b99c023d82de61712dfc4a0356417fdb0","/static/css/main.e6c13ad2.css":"bff9bd1a0098c18799dc53ed93b693d0e1383fcfce5b022e5b668096f8749ce7","/site_io_black_and_gray.svg":"69c263bf2712aa36d4668617b2a13965735deb3085b5ad960378ae4011764a1e","/static/css/main.e6c13ad2.css.map":"d245f3b59bc1362c13e9fc075b5ca242c6aacdd80271d2e93b54a3184b1d6d50","/static/js/787.3ce4cc4d.chunk.js":"0472dbef4b9eecc841b1ac199d8ac87829e225a390de27084376f6943cca2ef0","/static/js/787.3ce4cc4d.chunk.js.map":"e1da40838aa0d677ef00f69f721682f91e9d0895deef049f2d017a27b51e7006","/static/js/main.596d0abc.js.LICENSE.txt":"40c0039838766e50a37d99f40b403bdd92042a8037787e627a65731b21936282","/logo512.png":"8adda95d18cbc6c53da0a8c449a36341ef21605c952bf334317b8f0acd0e5951","/background.jpg":"b1c0c81e84d0941fe4551d327a5f94ec9462d3836b552385e720533ec636f9c3","/static/js/main.596d0abc.js":"f31ea0788aff751c37933b0311c4f00f13ba238a2cc2d2afbe5803a011704102","/static/js/main.596d0abc.js.map":"e83166a9bffa7685087eeabb21e2eec04e9ad5ec036958a3bcb33dba05288d13"}}
[2022-10-10T16:25:57.075Z] <<< [apiv2][status] POST https://firebasehosting.googleapis.com/v1beta1/projects/1234/sites/my-site/versions/fc834813ce5333b5:populateFiles 200
[2022-10-10T16:25:57.075Z] <<< [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/projects/1234/sites/my-site/versions/fc834813ce5333b5:populateFiles {"uploadUrl":"https://upload-firebasehosting.googleapis.com/upload/sites/my-site/versions/fc834813ce5333b5/files"}
[2022-10-10T16:25:57.076Z] [hosting][populate queue][FINAL] {"max":456,"min":456,"avg":456,"active":0,"complete":1,"success":1,"errored":0,"retried":0,"total":1,"elapsed":457}
[2022-10-10T16:25:57.076Z] [hosting] uploads queued: 0
[2022-10-10T16:25:57.076Z] [hosting][upload queue][FINAL] {"max":0,"min":9999999999,"avg":0,"active":0,"complete":0,"success":0,"errored":0,"retried":0,"total":0,"elapsed":1665419157076}
i  hosting: upload complete
✔  hosting[my-site]: file upload complete
[2022-10-10T16:25:57.077Z] [hosting] deploy completed after 2856ms
[2022-10-10T16:25:57.078Z] [
  {
    "config": {
      "public": "build",
      "predeploy": "yarn just ci",
      "ignore": [
        "firebase.json",
        "**/.*",
        "**/node_modules/**"
      ],
      "target": "admin",
      "cleanUrls": true,
      "trailingSlash": false,
      "rewrites": [
        {
          "regex": "/api(.*)",
          "run": {
            "serviceId": "api",
            "region": "southamerica-east1"
          }
        },
        {
          "source": "!/assets/**",
          "destination": "/index.html"
        },
        {
          "source": "**",
          "destination": "/index.html"
        }
      ],
      "site": "my-site"
    },
    "version": "projects/1234/sites/my-site/versions/fc834813ce5333b5"
  }
]
i  hosting[my-site]: finalizing version...
[2022-10-10T16:25:57.079Z] >>> [apiv2][query] GET https://cloudfunctions.googleapis.com/v1/projects/my-project/locations/-/functions [none]
[2022-10-10T16:25:57.646Z] <<< [apiv2][status] GET https://cloudfunctions.googleapis.com/v1/projects/my-project/locations/-/functions 403
[2022-10-10T16:25:57.647Z] <<< [apiv2][body] GET https://cloudfunctions.googleapis.com/v1/projects/my-project/locations/-/functions {"error":{"code":403,"message":"Cloud Functions API has not been used in project 1234 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudfunctions.googleapis.com/overview?project=1234 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=1234"}]},{"@type":"type.googleapis.com/google.rpc.ErrorInfo","reason":"SERVICE_DISABLED","domain":"googleapis.com","metadata":{"consumer":"projects/1234","service":"cloudfunctions.googleapis.com"}}]}}
[2022-10-10T16:25:57.649Z] [functions] failed to list functions for my-project
[2022-10-10T16:25:57.649Z] [functions] HTTP Error: 403, Cloud Functions API has not been used in project 1234 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudfunctions.googleapis.com/overview?project=1234 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
[2022-10-10T16:25:57.652Z] FirebaseError: HTTP Error: 403, Cloud Functions API has not been used in project 1234 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudfunctions.googleapis.com/overview?project=1234 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/johnny/.npm-global/lib/node_modules/firebase-tools/lib/responseToError.js:49:12)
    at RetryOperation._fn (/home/johnny/.npm-global/lib/node_modules/firebase-tools/lib/apiv2.js:288:77)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Error: Failed to list functions for my-project

@danieljaniga
Copy link

@johnnyasantoss workaround for "failed to list functions" for me was to create Service Account with these roles:

Firebase Hosting Admin
Firebase Rules Admin
Firebase Authentication Admin
Cloud Datastore Index Admin
Cloud Functions Viewer
Cloud Run Viewer
API Keys Viewer 

and use serviceaccount.json path in GOOGLE_APPLICATION_CREDENTIALS env variable

@johnnyasantoss
Copy link

@bkendall it seems to have fixed the issue. Thanks!

@mkdior
Copy link

mkdior commented Oct 17, 2022

We ourselves have been using FirebaseExtended/action-hosting-deploy and it also broke here. A couple days ago they pushed an update which allows you the specify the firebase-tools used using the following option:

      - name: 'Firebase deploy'
        uses: 'FirebaseExtended/action-hosting-deploy@v0'
        with:
          repoToken:                 '...'
          firebaseServiceAccount:    '...'
          projectId:                 '..'
          channelId:                 live
          entryPoint:                ./...
          firebaseToolsVersion:      'v11.13.0' # <--------------- Here

Commit in question which added the support: <<<<<<<<<

@wobsoriano
Copy link

@meuko does 11.15.0 fix your issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment