Dan*_*ill 3 deployment function gcloud
我正在尝试使用不同的服务帐户部署 Google Cloud Functions。我将服务帐户属性保存到 json 文件中。我交换了值以使其更易于阅读。
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/keys/mynewserviceaccount.json"
gcloud functions deploy MyFunction \
--runtime python37 \
--entry-point MyFunction \
--source src \
--service-account mynewserviceaccount@appspot.gserviceaccount.com \
--verbosity debug \
--stage-bucket staging.projectname.appspot.com \
--trigger-event providers/cloud.firestore/eventTypes/document.write \
--trigger-resource "projects/projectname/databases/(default)/documents/User/{userId}" &
Run Code Online (Sandbox Code Playgroud)
mynewserviceaccount 具有以下角色。我已经尝试了其他一些,但都没有成功。- 云函数管理员 - 云函数服务代理 - 错误编写器 - 服务帐户用户 - 日志编写器 - 发布/订阅订阅者
我还运行了 gcloud auth activate-service-account mynewserviceaccount@appspot.gserviceaccount.com --key-file "/path/to/keys/mynewserviceaccount.json"
当我运行这个时,我得到:错误:(gcloud.functions.deploy) ResponseError: status=[403], code=[Forbidden], message=[调用者没有权限]
当我尝试在角色列表中查找“gcloud.functions.deploy”时,我没有看到它。我不知道这是文档问题还是代码问题。
如果这是在运行gcloud builds submit命令时发生的,最可能的原因是Cloud Functions Developer没有为该服务启用角色Cloud Build。