Hi when I try to deploy my cloud function I get:
Could not build the function due to missing permissions. generic::permission_denied: Caller does not have required permission to use project emploify-592e2. 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=emploify-592e2 and then retry. Propagation of the new permission may take a few minutes.
These are all of the roles:
590666902450-compute@developer.gserviceaccount.com | Default compute service account |
|
|
|
|||
emploify-592e2@appspot.gserviceaccount.com | App Engine default service account |
|
|
|
|||
<PII removed by staff> |
|
|
|
||||
<PII removed by staff> | Filip Hessle |
|
|
|
|||
firebase-adminsdk-1b9s8@emploify-592e2.iam.gserviceaccount.com | firebase-adminsdk |
|
|
|
|||
firebase-service-account@firebase-sa-management.iam.gserviceaccount.com |
|
|
|
||||
firebase@flutterflow.io |
|
|
|
||||
rowy-backend@emploify-592e2.iam.gserviceaccount.com | Rowy Backend |
|
|
|
|||
rowy-functions@emploify-592e2.iam.gserviceaccount.com | Rowy Functions |
|
|
|
|||
rowy-hooks@emploify-592e2.iam.gserviceaccount.com | Rowy Hooks |
|
|
|
|||
rowy-service@emploify-592e2.iam.gserviceaccount.com | Rowy Service Account |
|
Hi @Filip123,
Welcome to the Google Cloud community!
Most of the principals listed down in the IAM table have "Owner", "Editor" or "Cloud Function Admin" roles alongside the "Service Usage Consumer" role that was asked of you to grant to resolve the issue. The root cause of this seems odd as Cloud Run functions don't usually require the said role by default (see IAM roles for Cloud Run functions), so it may depend on how your function code does its intended work and the exact APIs it's trying to use during runtime.
Depending on which exact principal is affected during your deployment (whether it's a real user account or a service account), and from what environment you're attempting to deploy your function, could you try to perform a login command like:
gcloud auth login user@domain.com
Where "user@domain.com" can be substituted by the exact email account you authenticated to use GCloud CLI operations.
If you're interacting with GCloud SDK through your code, you can use this command:
gcloud auth application-default login
This will see to it that your account is remaining logged in and Google Cloud still recognizes the authenticated account during the function deployment.
If you're using a Firebase CLI tool (as I've noticed that you have a Firebase Admin SDK service account), make sure to keep the CLI version up-to-date.
Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.