Skip to content

Upgrading firebase-admin requires additional serviceUsageConsumer permissions #2658

@IchordeDionysos

Description

@IchordeDionysos

[REQUIRED] Step 2: Describe your environment

  • Operating System version: Cloud Functions
  • Firebase SDK version: 12.3.0 (upgrading from 12.1.1)
  • Firebase Product: auth
  • Node.js version: 20
  • NPM version: _____

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

What happened? How can we make the problem occur?
This could be a description, log/console output, etc.

When upgrading the package, we suddenly get the following error:

Error: //console.developers.google.com/iam-admin/iam/project?project=some-project and then retry. Propagation of the new permission may take a few minutes. Raw server response: "{"error":{"code":403,"message":"Caller does not have required permission to use project some-project. 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=some-project and then retry. Propagation of the new permission may take a few minutes.","errors":[{"message":"Caller does not have required permission to use project some-project. 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=some-project and then retry. Propagation of the new permission may take a few minutes.","domain":"global","reason":"forbidden"}],"status":"PERMISSION_DENIED","details":[{"@type":"type.googleapis.com/google.rpc.Help","links":[{"description":"Google developer console IAM admin","url":"https://console.developers.google.com/iam-admin/iam/project?project=some-project"}]},{"@type":"type.googleapis.com/google.rpc.ErrorInfo","reason":"USER_PROJECT_DENIED","domain":"googleapis.com","metadata":{"consumer":"projects/simpleclub-stage","service":"identitytoolkit.googleapis.com"}}]}}"
    at FirebaseAuthError.fromServerError (/workspace/node_modules/firebase-admin/lib/utils/error.js:148:16)
    at /workspace/node_modules/firebase-admin/lib/auth/auth-api-request.js:1628:49
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    ...

The service account(s) in question have the following roles (which should be sufficient)?

  • Firebase Authentication Viewer

Relevant Code:

await auth.verifyIdToken(idToken); // this is successful
const user = await auth.getUser(userId); // this is not and fails

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions