简体   繁体   English

对 AWS AMPLIFY 的 Cognito 的 S3 权限不起作用

[英]S3 permissions to Cognito for AWS AMPLIFY not working

I keep getting a TypeError: Cannot read properties of undefined (reading 'byteLength') Error when using AWS with Amplify.将 AWS 与 Amplify 结合使用时,我不断收到TypeError: Cannot read properties of undefined (reading 'byteLength')错误。

It looks like the s3 bucket permissions were not created properly when I added the s3 through the Amplify CLI.当我通过 Amplify CLI 添加 s3 时,似乎没有正确创建 s3 存储桶权限。

When I add the sample s3 bucket policy from https://docs.amplify.aws/lib/storage/getting-started/q/platform/js/当我从https://docs.amplify.aws/lib/storage/getting-started/q/platform/js/添加示例 s3 存储桶策略时

It keeps saying that I need to add a principal.它一直说我需要添加一个委托人。

Question is: What do I add for the principal for an authenticated user?问题是:我要为经过身份验证的用户添加什么主体? Does anyone have a sample?有人有样品吗?

When I add the sample s3 bucket policy当我添加示例 s3 存储桶策略时
Question is: What do I add for the principal for an authenticated user?问题是:我要为经过身份验证的用户添加什么主体? Does anyone have a sample?有人有样品吗?

The policies mentioned are to be attached to the IAM cognito roles Auth_Role and Unauth_Role (or however are the roles for the cognito users named) not the S3 bucket.提到的策略将附加到 IAM 认知角色Auth_RoleUnauth_Role (或者是命名的认知用户的角色)而不是 S3 存储桶。 Then the principal is the IAM role itself.那么委托人就是 IAM 角色本身。

In theory you may attach the defined policies to the S3 bucket and define the principals as the Cognito roles for the authenticated and unauthenticated users理论上,您可以将定义的策略附加到 S3 存储桶,并将委托人定义为已验证和未验证用户的 Cognito 角色

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM