Skip to content

Uncaught TypeError: Cannot read properties of undefined (reading 'loginWith') at AmplifyClass.notifyOAuthListener (Amplify.ts:63:49)

0

aws-amilfy 6.13.1

aws-config.jsi mport { Amplify } from "aws-amplify";

const awsExports = { Auth: { region: 'us-west-1', userPoolId: 'us-west-1_mJ0nwfHd2', userPoolWebClientId: '5132d0n28h947jm6gv4t06n2vl', authenticationFlowType: 'USER_PASSWORD_AUTH', aws_cognito_identity_pool_id: undefined, // Prevent Amplify from expecting federated identity pools }, Storage: { AWSS3: { bucket: import.meta.env.VITE_S3_BUCKET_NAME, region: import.meta.env.VITE_COGNITO_REGION, }, }, };

console.log("Amplify Configuration:", awsExports); Amplify.configure(awsExports);

export default Amplify;

The error Amplify Configuration: {Auth: {…}, Storage: {…}}Auth: authenticationFlowType: "USER_PASSWORD_AUTH"aws_cognito_identity_pool_id: undefinedregion: "us-west-1"userPoolId: "us-west-1_mJ0nwfHd2"userPoolWebClientId: "5132d0n28h947jm6gv4t06n2vl"[[Prototype]]: ObjectStorage: {AWSS3: {…}}[[Prototype]]: Object Amplify.ts:63 Uncaught TypeError: Cannot read properties of undefined (reading 'loginWith') at AmplifyClass.notifyOAuthListener (Amplify.ts:63:49) at AmplifyClass.configure (Amplify.ts:41:14) at Object.configure (initSingleton.ts:41:21)

Could you please help?

asked 2 years ago634 views

1 Answer
0
Accepted Answer

Fixed. I forgot "Cognito"

const awsExports = { Auth: { Cognito: { region: 'us-west-1', userPoolId: 'us-west-1_mJ0nwfHd2', userPoolWebClientId: '5132d0n28h947jm6gv4t06n2vl', authenticationFlowType: 'USER_PASSWORD_AUTH', aws_cognito_identity_pool_id: undefined, // Prevent Amplify from expecting federated identity pools } }, Storage: { AWSS3: { bucket: import.meta.env.VITE_S3_BUCKET_NAME, region: import.meta.env.VITE_COGNITO_REGION, }, }, };

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.