当我试图创建一个“传输”以将Google中的一个桶的内容转移到同一个所有者下的Google中的另一个桶时,我会遇到这个错误:
要完成此传输,需要源桶的“storage.buckets.setIamPolicy”权限。请桶管理员授予您所需的权限,然后再试一次。
我不知道该怎么做。我试着去“桶->权限->添加成员-> myemail.com for Storage -> ...Admin”,但我一直得到"IAM策略更新失败“。
请帮助如何使这一工作,以便我可以使我的文件公开。
如果这有帮助的话,我正在使用Node.js。
如果我甚至试图获取照片并直接绕过它,我甚至不能这样做:/
const { Storage } = require('@google-cloud/storage')
const storage = new Storage({
projectId: 'my-bucket'
})
const bucket = storage.bucket('my.bucket')
app.get('/photo/:photo.:ext', (req, res) => {
const remoteFile = bucket.file(`photo/${req.params.photo}.${req.params.ext}`)
remoteFile.createReadStream().pipe(res)
})也不能这样做:
const opts = {
includeFiles: true
};
bucket.makePublic(opts, function(err, files) {
// `err`:
// The first error to occur, otherwise null.
//
// `files`:
// Array of files successfully made public in the bucket.
console.log(arguments)
});无法为只启用桶策略的桶获取遗留ACL。在https://cloud.google.com/storage/docs/bucket-policy-only阅读更多内容。
$ gsutil iam ch allUsers:objectViewer gs://my.bucket
ServiceException: 401 Anonymous caller does not have storage.buckets.getIamPolicy access to my.bucket.发布于 2019-06-11 12:12:16
此错误明确表示源桶上缺少权限。我建议您确认源桶上的所有者具有storage.objects.getIamPolicy权限( IAM &admin->IAM菜单->由所有者的电子邮件地址筛选->检查它上的角色)。然后,您可以检查角色是否具有该权限,storage.objects.getIamPolicy (转到IAM&admin -> roles,然后搜索特定角色->单击它,它将显示分配的权限列表。确保storage.objects.getIamPolicy是为角色列出的权限之一
同时,为了能够授予对特定存储桶的访问权限,您的帐户角色必须是仓储管理。因此,如果您的帐户没有此角色,则需要有此角色的人才能授予访问权限或具有对桶的其他控制。
https://stackoverflow.com/questions/56445483
复制相似问题