【发布时间】:2019-05-25 20:55:06
【问题描述】:
我正在一个 Google Cloud 项目中处理一系列 Cloud Functions,但由于某种原因,我突然收到此错误:
Deployment failure:
Missing necessary permission resourcemanager.projects.getIamPolicy for service-1092904037961@gcf-admin-robot.iam.gserviceaccount.com on resource projects/la-cloud-functions. Please grant service-1092904037961@gcf-admin-robot.iam.gserviceaccount.com the Cloud Functions Service Agent role. You can do that by running 'gcloud iam service-accounts add-iam-policy-binding projects/la-cloud-functions --member=service-1092904037961@gcf-admin-robot.iam.gserviceaccount.com --role=Cloud Functions Service Agent'
当我尝试运行修改后的命令时,除了格式错误的错误响应(你不能有--role=Cloud Functions Service Agent - 它应该是--role=roles/cloudfunctions.serviceAgent):
gcloud iam service-accounts add-iam-policy-binding projects/la-cloud-functions --member=service-1092904037961@gcf-admin-robot.iam.gserviceaccount.com --role=roles/cloudfunctions.serviceAgent
我收到此错误:
The requested URL <code>/v1/projects/la-cloud-functions/serviceAccounts/projects/la-cloud-functions:getIamPolicy?alt=json</code> was not found on this server.
最后,尝试通过控制台分配 Cloud Functions Server Agent 角色给了我另一个惊喜 - 列表中缺少该角色,它应该在服务管理下:
我已尝试通过使用以下命令重新启用 Cloud Functions API 来重置服务帐户:
gcloud services enable cloudfunctions.googleapis.com
但同样,没有成功。
有人对如何解决此问题并使 Cloud Functions 服务代理角色再次可用有任何想法吗?
TIA - 乔
【问题讨论】:
-
如果其他人遇到这个问题,我运行了 John Hanley 在他的回答中提供的服务帐户创建脚本,但它没有出现。 Google 在 IAM 页面右上角添加了一个“包括 Google 提供的角色授予”复选框,点击它就会出现。
标签: google-cloud-platform google-cloud-functions google-iam