google-app-engine - 谷歌云功能权限问题

标签 google-app-engine google-cloud-platform google-cloud-functions

我在 GCP 中有两个项目,假设项目 A 和 B。项目 A 是新创建的,项目 B 已有两年了。当我在项目 A 中创建云函数时,它是使用默认服务帐户 (project@appspot...) 创建的。但是,当我在项目 B 上创建云函数时,使用了不存在的服务帐户。我知道它不存在,因为它没有出现在 IAM 上。

在项目A中创建的云函数可以访问数据存储,但是项目B中的相同云函数无法访问数据存储。

所以,我的问题是:

  1. 我如何知道云功能将使用哪个 Google 服务帐户?

  2. 有没有办法更改项目 B 使用的服务帐户以获得访问数据存储的云功能?

我尝试过给云功能适当的权限,但是只要是在项目B中就不行。我在这里缺少什么?

最佳答案

您似乎需要在项目 B 中检查两个不同的帐户。

首先是 Google API 服务帐户。您应该确保它存在并且具有正确的凭据才能正确使用 Cloud Functions。以下是 GCP 文档中的文档:

For administrative actions on your project during the creation, updating, or deletion of functions, the Cloud Functions service uses the Google APIs service account [email protected]. By default, this service account has the Editor role on your project. Creating, updating, and deleting functions may fail if you reduce this account's permissions.

接下来是运行时服务帐户。从您描述的问题来看,这可能是真正的问题。同样,这里是解释它的文档:

At runtime, Cloud Functions uses the service account [email protected], which has the Editor role on the project. You can change the roles of this service account to limit or extend the permissions for your running functions.

关于google-app-engine - 谷歌云功能权限问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48406271/

相关文章:

google-cloud-platform - 如何使用 Google Cloud Builder 创建具有依赖关系的多个容器

database - Firebase - 使用云功能定位特定的 Firestore 文档字段

node.js - 在 onCreate Firestore 事件后每 30 分钟运行一次 Cron 作业

python - 以编程方式在 Python 中提交表单?

java - 应用程序默认凭据无法创建 Google App Engine 服务帐户凭据

python - 无法执行 Cloud Function 触发不允许未经身份验证的调用的 HTTP 触发 Cloud Function?

python - Gitlab CI Runner 无法在 Python 中导入 Google.Cloud

javascript - Firebase 函数 onCreate() onDelete() 路径特异性

python - GAE : remote_api_shell. py 使用了错误的 Django 版本

java - 在应用程序引擎任务队列(JAVA)中传递多个参数