-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Environment info
firebase-tools:
firebase cli v13.8.0
Debian v12
Platform:
Google CloudShell
firebase cli v13.8.0
and gcloud SDK v475.0.0
Test case
Testing
Tests were conducted using firebase cli v13.8.0
and gcloud SDK v475.0.0
.
- Pass: The
service account
was able to access the firebase project as the correct permission appears to be available. - Fail: The
user account
is unable to access the firebase project. I have provided the error log below.
Steps to reproduce
In testing, I used both a user account (on CloudShell - Debian 12) and a service account (via GCE instance Debian 12).
The test project includes a Firebase project accessed from Google Cloud Shell. The Firebase project features a Firestore database. Logging into the project was successful, however I was unable to access any services e.g.:
- projects:list - see output below:
- set up a firestore rules - same error relating to the service account
Expected behavior
Facing issues when using a user account to access Firebase using the CLI tool. I believe the issue relates to the below PR.
Ref: PR
Both user and service accounts should be able to access the firebase project services when using only the roles/firebase.admin
permission.
Actual behavior
When using CloudShell on Google Cloud, where the user account has been given roles/firebase.admin
permission. Previously this has been working since the end of 2023 deployment in a lab delivered on the CloudSkillsBoost site.
The internal link for this is b/341023115
After the above some recent changes to Firebase cli, the user account with roles/firebase.admin
is no longer able to access Firebase projects using the cli tool. The response indicates an additional service account permission is required (i.e. roles/serviceusage.serviceUsageConsumer
).
I believe the relevant change is here: PR.
Error Log
I have the following information from firebase-debug-log
:
[debug] [2024-05-22T09:44:10.933Z] ----------------------------------------------------------------------
[debug] [2024-05-22T09:44:10.935Z] Command: /usr/local/nvm/versions/node/v20.13.0/bin/node /usr/local/nvm/versions/node/v20.13.0/bin/firebase projects:list
[debug] [2024-05-22T09:44:10.936Z] CLI Version: 13.8.0
[debug] [2024-05-22T09:44:10.936Z] Platform: linux
[debug] [2024-05-22T09:44:10.936Z] Node Version: v20.13.0
[debug] [2024-05-22T09:44:10.936Z] Time: Wed May 22 2024 09:44:10 GMT+0000 (Coordinated Universal Time)
[debug] [2024-05-22T09:44:10.936Z] ----------------------------------------------------------------------
[debug]
[debug] [2024-05-22T09:44:10.950Z] > 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"]
[debug] [2024-05-22T09:44:10.951Z] > authorizing via signed-in user ([[email protected]](mailto:[email protected]))
[debug] [2024-05-22T09:44:10.959Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects pageSize=1000
[debug] [2024-05-22T09:44:11.336Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects 403
[debug] [2024-05-22T09:44:11.337Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects [omitted]
[debug] [2024-05-22T09:44:11.338Z] HTTP Error: 403, Caller does not have required permission to use project qwiklabs-gcp-01-c80f0bc444a8. Grant the caller the roles/serviceusage.serviceUsageConsumer role, or a custom role with the serviceusage.services.use permission, by visiting https://console.developers.google.com/iam-admin/iam/project?project=qwiklabs-gcp-01-c80f0bc444a8 and then retry. Propagation of the new permission may take a few minutes.
[debug] [2024-05-22T09:44:11.340Z] FirebaseError: HTTP Error: 403, Caller does not have required permission to use project qwiklabs-gcp-01-c80f0bc444a8. Grant the caller the roles/serviceusage.serviceUsageConsumer role, or a custom role with the serviceusage.services.use permission, by visiting https://console.developers.google.com/iam-admin/iam/project?project=qwiklabs-gcp-01-c80f0bc444a8 and then retry. Propagation of the new permission may take a few minutes.
at responseToError (/usr/local/nvm/versions/node/v20.13.0/lib/node_modules/firebase-tools/lib/responseToError.js:49:12)
at RetryOperation._fn (/usr/local/nvm/versions/node/v20.13.0/lib/node_modules/firebase-tools/lib/apiv2.js:305:77)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[error]
[error] Error: Failed to list Firebase projects. See firebase-debug.log for more info.