Amplify add storage - 允许未经身份验证的用户需要进行身份验证配置,但未正确配置

Posted

技术标签:

【中文标题】Amplify add storage - 允许未经身份验证的用户需要进行身份验证配置,但未正确配置【英文标题】:Amplify add storage - Auth configuration is required to allow unauthenticated users, but it is not configured properly 【发布时间】:2021-07-04 14:08:42 【问题描述】:

我很确定我已经正确配置了 cognito,因为我可以注册、登录和退出。一切都在 aws-exports 中配置。有人知道如何调试吗?

$ amplify add storage
? Please select from one of the below mentioned services: Content (Images, audio, video, etc.)
? Please provide a friendly name for your resource that will be used to label this category in the project: botshopsStorage
? Please provide bucket name: botshops
? Who should have access: Auth and guest users
? What kind of access do you want for Authenticated users? create/update, read, delete
? What kind of access do you want for Guest users? read
? Do you want to add a Lambda Trigger for your S3 Bucket? No
Auth configuration is required to allow unauthenticated users, but it is not configured properly.
An error occurred when adding the storage resource
Error: Auth configuration is required to allow unauthenticated users, but it is not configured properly.
    at configure (C:\snapshot\node_modules\amplify-category-storage\lib\provider-utils\awscloudformation\service-walkthroughs\s3-walkthrough.js:405:11)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async addWalkthrough (C:\snapshot\node_modules\amplify-category-storage\lib\provider-utils\awscloudformation\service-walkthroughs\s3-walkthrough.js:58:12)
    at async Object.executeAmplifyCommand (C:\snapshot\node_modules\amplify-category-storage\lib\index.js:114:3)
    at async executePluginModuleCommand (C:\snapshot\node_modules\@aws-amplify\cli\lib\execution-manager.js:163:5)
    at async Object.executeCommand (C:\snapshot\node_modules\@aws-amplify\cli\lib\execution-manager.js:35:9)
    at async Object.run (C:\snapshot\node_modules\@aws-amplify\cli\lib\index.js:112:9)

micha@DESKTOP-P5RTAG7 MINGW64 ~/repos/botshops (master)
$ amplify status

Current Environment: dev

| Category | Resource name    | Operation | Provider plugin   |
| -------- | ---------------- | --------- | ----------------- |
| Auth     | botshopsff8e5633 | No Change | awscloudformation |
| Api      | botshops         | No Change | awscloudformation |

【问题讨论】:

如果没有看到您如何配置未经身份验证的角色以及是否启用了未经身份验证的访问,将很难说什么。 【参考方案1】:

对我来说,解决方法是删除身份验证并重新添加。 放大删除身份验证 放大添加授权

【讨论】:

以上是关于Amplify add storage - 允许未经身份验证的用户需要进行身份验证配置,但未正确配置的主要内容,如果未能解决你的问题,请参考以下文章

放大未捕获的 AppSync 订阅(承诺中)

AWS amplify add auth:如何在执行 amplify cli 后添加重定向登录 URI

AuthError - 错误:未正确配置 Amplify / AWS cognito,React JS

aws-amplify-react Connect 首先返回未定义的数据

AuthError - 错误:未正确配置 Amplify

对象 Amplify Schema 定义中未显示一对多关系