等待 Google 云服务帐户角色更改传播的时间

Wait time for Google Cloud service account role change to propagate

我正在使用下载的 JSON 文件包含服务帐户密钥,而不是 ADC,在我的本地开发人员机器上使用代码 运行 并与实时 GCP Firestore 通信。

在为角色添加服务帐户后,在我的情况下roles/datastore.user,我需要做些什么才能生效吗?

例如等待 15 分钟,重新下载 JSON,重新启动一些服务,还有什么?

问题与我机器上的自动化测试 运行 中的这个错误有关。

Test method MyProject.Data.Repositories.FirestoreRepositoryTests.FirestoreAccountDocRepository_UpdateAsync__updates threw exception: 
Grpc.Core.RpcException: Status(StatusCode="PermissionDenied", Detail="Permission denied on resource project my-project-prodlike.", DebugException="Grpc.Core.Internal.CoreErrorDetailException: {"created":"@1642697226.430711000","description":"Error received from peer ipv4:172.217.169.74:443","file":"/Users/einari/Projects/grpc/grpc/src/core/lib/surface/call.cc","file_line":1074,"grpc_message":"Permission denied on resource project my-project-prodlike.","grpc_status":7}")

注意 - 我正在使用 Contrib.Grpc.Core.M1 因为我使用的是新 MacBook。

注意 - 我不再使用上面的内容,现在使用 Google 的解决方法 GRPC lib 适配器,以防万一。参见 https://github.com/googleapis/google-cloud-dotnet/issues/7560#issuecomment-975414370

权限被拒绝的问题是由不正确的项目名称引起的(而不是实际被拒绝的权限)。

Google云控制台的顶部是当前项目的名称。然而,这实际上只是一个无意义的别名,默认情况下不会显示真正的项目标识符,尽管它在浏览器中 URL。

当然,错误消息暗示它找到了它的目标资源并且它拒绝了访问。

好累