尝试请求认知时没有用户池

No User Pool when try to request cognito

我用了 amplify add auth,效果很好,然后 amplify push。 React 网站 运行 没问题。但是当我尝试注册或登录时,出现错误 [ERROR] AuthClass - Cannot get the current user because the user pool is missing. Please make sure the Auth module is configured with a valid Cognito User Pool ID。 但是 aws_user_pools_id 与 aws 控制台中的 id 相同。 有人知道问题可能是什么吗? 谢谢 ;)

那是我的 App.js,没有魔法...

import React, { Component } from 'react';
import './App.css';
import HomeScreen from './screens/HomeScreen';
import { withAuthenticator } from 'aws-amplify-react';

class App extends Component {
  render() {
    return (
      <div className="App">
        <HomeScreen />
      </div>
    );
  }
}

export default withAuthenticator(App);

我在 aws 上遇到过类似的问题,为了解决这个问题,我简单地创建了一个新的用户池,然后我就可以登录并注册了。

问题是,您还必须添加配置方法:

import Amplify from 'aws-amplify';
import aws_exports from './aws-exports';
import { withAuthenticator } from 'aws-amplify-react';
Amplify.configure(aws_exports);

我必须执行以下操作并且有效。

amplify push
amplify publish

在那之后,No userPool 错误消失了,我收到了一个确认码,在电子邮件中收到了它,然后用它来确认我的帐户。然后我就可以登录了。

为该地区增加价值解决了我的错误。 默认值:区域:'' 新:区域:'us-east-1'