aws-amplify - Amplify Auth SignUp auto send another request and throw Error: No credentials, applicationId or region
问题描述
I have 2 projects which are using the same code like this:
Auth.signUp({ username, password, attributes })
.then(data => console.log(data))
.catch(error => console.log(error))
.finally(() => console.log('done'));
Just like this: https://aws-amplify.github.io/docs/js/authentication#sign-up
Here is the problem show out:
In my old project, everything is ok, just 1 request is sign up send to AWS and got some data from it: https://cognito-idp.ap-southeast-2.amazonaws.com/
In my new project, I have another request go to AWS after the sign up request. There are: https://cognito-idp.ap-southeast-2.amazonaws.com/ And : https://cognito-identity.ap-southeast-2.amazonaws.com/ which is after the first one and its response is : message: "Unauthenticated access is not supported for this identity pool." __type: "NotAuthorizedException"
After that, I got the error in console: Error: No credentials, applicationId or region.
Not sure why is the old project is working fine but with this one, this error show up. Is it because the different in amplify ?
Thanks.
解决方案
从我对这个链接的理解来看,我认为问题出在 AWS 的分析包上。像这样禁用它对我有用
import config from './aws-exports';
Amplify.configure({
...config,
Analytics: {
disabled: true
}
});
推荐阅读
- javascript - 代码完成在回调中不起作用
- postgresql - PostgreSQL:列 VS 数组
- python - 如何使输入等于另一个文件中的一行
- c# - 线程数据可视化和计时器
- reactjs - mapStateToProps 在 componentDidMount 内调度之前触发,导致数据未定义
- android - 当我尝试将数据写入块时出现 TagLostException
- reactjs - 为什么我不能使用 npx create-react-app 命令?
- python - 读取数据框时获取浮点值
- javascript - 切片方法在这里的作用是什么?为什么需要它?
- google-apps-script - Google HTML 脚本未能调用服务器端函数:“从存储读取时发生服务器错误。错误代码 PERMISSION_DENIED。”