AuthError - Error: Amplify has not been configured correctly / AWS cognito, React JS

Viewed 807

I am facing this issue. After installing amplify-cli, aws-amplify and aws-amplify-react, not able to use aws cognito. My code snippet is given below.

import React from 'react';
import { withAuthenticator } from 'aws-amplify-react';
import config from './aws-exports';
function App() {
  return (
    <div>
        <b>Hello World..</b>
    </div>
  );
}

export default withAuthenticator(App, {includeGreetings: true});

I have added amplify add auth amplify push

But constantly getting this issue.

Error image attached below.. please have a look enter image description here

1 Answers

Finally solved the issue after a lot of research. The problem is solved by installing @aws-amplify/core package in the react js application by using the following command.

npm i @aws-amplify/core --save --legacy-peer-deps

But after installing that in my case, I received error as this package was showing a lot of dependency packages. So after finally adding all those as mentioned below, the cognito aws login/signup problem got solved..

npm i @aws-amplify/storage --save --legacy-peer-deps
npm i @aws-amplify/interactions --save --legacy-peer-deps
npm i @aws-amplify/auth --save --legacy-peer-deps
npm i @aws-amplify/api --save --legacy-peer-deps
npm i @aws-amplify/analytics --save --legacy-peer-deps
npm i @aws-amplify/xr --save --legacy-peer-deps

Related