我们已经根据给定的需求开发了一个云功能,并与第一代进行了初步验证,结果很好。但几乎不需要修改,这需要额外的处理时间。因此,我们不得不切换到第二代
下面是gcloud函数deploy命令。
gcloud functions deploy gen2-function
--entry-point gen2 --runtime python37 --trigger-http --allow-unauthenticated
--service-account=<> --region=<> --project=<> --timeout=3600s --gen2
该命令成功部署了功能并在内部云运行服务,但最终失败,出现以下错误
[INFO] A new revision will be deployed serving with 100% traffic.
ERROR: (gcloud.functions.deploy) PERMISSION_DENIED: Permission 'run.services.setIamPolicy' denied on resource 'projects/<project>/locations/<region>/services/gen2-function' (or resource may not exist).
当我们检查云运行时,服务名称";gen2函数";确实存在。
有人能指导一下吗?
部署该功能的帐户缺少权限run.services.setIamPolicy
。指定命令参数--allow-unauthenticated
需要该权限。
该权限属于角色roles/run.admin
。
请参阅本文档,了解如何向帐户添加角色:
使用GUI 授予单个角色
授予或撤销多个角色