简体   繁体   中英

What is the source of this error? ERROR: (gcloud.run.services.add-iam-policy-binding) NOT_FOUND: Requested entity was not found

I'm working through the example at this URL , but I'm running into the error below. What is the source of that error?

ERROR: (gcloud.run.services.add-iam-policy-binding) NOT_FOUND: Requested entity was not found.

I'm running the script below, but obviously with a different parameter set. I verified in the GUI/Console that the service account was created, the $serviceAccount variable has the correct value, the service exists, and the service name is correct. Also, I'm able to manually add the service account to the service in the invoker role in the GUI/Console.

param(
    $cloudRunInvokerServiceAccount = 'some-service-account',
    $projectId = 'some-project-id',
    $nameOfServiceBeingInvoked = 'some-service'                                
)

gcloud iam service-accounts create $cloudRunInvokerServiceAccount --display-name $cloudRunInvokerServiceAccount

$serviceAccount = "serviceAccount:$cloudRunInvokerServiceAccount@$projectId.iam.gserviceaccount.com"

gcloud run services add-iam-policy-binding $nameOfServiceBeingInvoked `
   --member=$serviceAccount `
   --role=roles/run.invoker `
   --platform=managed

I also reviewed the docs for good measure.

Also, I ran gcloud run services list and gcloud iam service-accounts list to verify the existence of the services/accounts and their status (enabled).

I have seen this error with old versions of the Google Cloud CLI gcloud .

The solution is to update the Google Cloud SDK and components.

Windows:

  • Open an elevated Windows Commmand Prompt.
  • Execute this command and follow the prompts: gcloud components update

Linux:

  • Execute this command and follow the prompts: sudo gcloud components update

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM