经过身份验证的云功能:权限不足,无法访问Firestore

时间:2020-06-14 13:58:14

标签: node.js google-cloud-firestore google-cloud-functions

我正在为此doc设置用于功能调用的经过身份验证的Cloud Functions。在我的用例中,调用函数为CF1,接收函数为CF2

我已经为CF1设置并分配了一个服务帐户(my-func-invoker@myproject.iam.gserviceaccount.com),并将CF2的Cloud Functions Invoker角色设置/分配给了该my-func-invoker@myproject.iam.gserviceaccount.com服务帐户。一切都很好,CF1可以毫无问题地调用CF2。

但是在CF1中,有两个工作流程:

  1. 调用CF2
  2. 读/写到Firestore

将服务帐户分配给CF1之后,CF1失去了读写Firestore的权限(我的firestore当前授予了所有读写权限),并引发了7 PERMISSION_DENIED: Missing or insufficient permissions.错误。

有什么我想念的吗?

1 个答案:

答案 0 :(得分:0)

您可能只需要赋予服务帐户#1正确的角色即可访问firestore [0]。我将检查当前授予SA哪些角色,并查看它是否缺少所需的条件。

[0] https://cloud.google.com/firestore/docs/security/iam#roles