Firebase Admin Storage:调用者没有权限
Firebase Admin Storage: The caller does not have permission
我有一个项目使用 Firebase Admin 上的默认存储桶。
我有以下行:
const [url] = await blob.getSignedUrl({ action: 'read', expires: Date.now() + 60 * 1000, contentType: mimetype })
当调用我的 HTTPS 可调用函数时,上面的行抛出以下错误:
Unhandled error Error: The caller does not have permission
at Gaxios._request (/workspace/node_modules/gaxios/build/src/gaxios.js:129:23)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Compute.requestAsync (/workspace/node_modules/google-auth-library/build/src/auth/oauth2client.js:368:18)
at async GoogleAuth.signBlob (/workspace/node_modules/google-auth-library/build/src/auth/googleauth.js:655:21)
at async sign (/workspace/node_modules/@google-cloud/storage/build/src/signer.js:97:35) {
name: 'SigningError'
}
我做错了什么?
已经有一个打开的GitHub issue。如果这是
正是你在找什么,你可以通过解决方案
在 GitHub 问题上列出:
转到项目的 Cloud Console > IAM & admin > IAM
,找到 App Engine default service account
并将 Service Account Token Creator
角色添加到该成员。这将允许您的应用创建图像的签名 public 网址。
如果它对您不起作用,请尝试更新 IAM 角色。来自
firebaseSA.json 文件查看关联的电子邮件是否具有这些角色:
Firebase Admin SDK Administrator ,Service Agent, Service Account
Token Creator ,Pub/Sub Publisher, Storage Admin
如果它仍然不适合您,请尝试 运行 您的应用程序
具有所有可能的云存储的另一个服务帐户
权限,有用吗?如果是,则意味着您当前的
服务需要额外的权限才能执行该功能。你
可以在 Cloud Storage IAM Roles
中查看要授予的权限
我有一个项目使用 Firebase Admin 上的默认存储桶。
我有以下行:
const [url] = await blob.getSignedUrl({ action: 'read', expires: Date.now() + 60 * 1000, contentType: mimetype })
当调用我的 HTTPS 可调用函数时,上面的行抛出以下错误:
Unhandled error Error: The caller does not have permission
at Gaxios._request (/workspace/node_modules/gaxios/build/src/gaxios.js:129:23)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Compute.requestAsync (/workspace/node_modules/google-auth-library/build/src/auth/oauth2client.js:368:18)
at async GoogleAuth.signBlob (/workspace/node_modules/google-auth-library/build/src/auth/googleauth.js:655:21)
at async sign (/workspace/node_modules/@google-cloud/storage/build/src/signer.js:97:35) {
name: 'SigningError'
}
我做错了什么?
已经有一个打开的GitHub issue。如果这是 正是你在找什么,你可以通过解决方案 在 GitHub 问题上列出:
转到项目的
Cloud Console > IAM & admin > IAM
,找到App Engine default service account
并将Service Account Token Creator
角色添加到该成员。这将允许您的应用创建图像的签名 public 网址。如果它对您不起作用,请尝试更新 IAM 角色。来自 firebaseSA.json 文件查看关联的电子邮件是否具有这些角色:
Firebase Admin SDK Administrator ,Service Agent, Service Account Token Creator ,Pub/Sub Publisher, Storage Admin
如果它仍然不适合您,请尝试 运行 您的应用程序 具有所有可能的云存储的另一个服务帐户 权限,有用吗?如果是,则意味着您当前的 服务需要额外的权限才能执行该功能。你 可以在 Cloud Storage IAM Roles
中查看要授予的权限