无法在其他项目下的存储桶上创建云函数触发器。
Deploying function (may take a while - up to 2 minutes)...failed.
ERROR: (gcloud.functions.deploy) OperationError: code=7, message=Insufficient permissions to (re)configure a trigger (permission denied for bucket ing-auto). Please, give owner permissions to the editor role of the bucket and try again.
对于云功能中使用的服务帐户,拥有对存储桶所在项目的所有者访问权限。
IE
有两个项目project-a和project-b。
云函数需要在中创建项目-a .
谷歌存储桶在项目-b 中。
服务帐号用户 服务用户 是项目-a 的一部分,拥有项目-b 的所有者访问权限,将用于执行云功能。
gcloud functions deploy hello_gcs --runtime python37 --trigger-resource bucket-from-other-project-xxx --trigger-event goog
le.storage.object.finalize
我能够在同一项目的存储桶上创建云函数存储触发器
最佳答案
这不可能。引用 Google Cloud Functions documentation :
Cloud Functions can only be triggered by Cloud Storage buckets in the same Google Cloud Platform project.
作为一种可能的解决方法,您可以将 Cloud Function 部署为 HTTP triggered .然后,在存储桶所属的项目中,部署另一个由 Cloud Storage 事件触发的 Cloud Function,并在其代码中进行 HTTP 调用以触发第一个 Cloud Function。
关于google-cloud-platform - 其他项目桶上的云函数存储触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55726854/