I have an amplify-authenticator
form which I use to reset the password. If I enter a wrong code, I get a response from the API which says
CodeMismatchException: Invalid verification code provided, please try again.
which is correct, but the entire form then freezes and I also get this message in the console of the browser:
Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading ‘authAttributes’)
TypeError: Cannot read properties of undefined (reading ‘authAttributes’)
at actorDoneData (index.js:2:34774)
which points to webpack:///node_modules/@aws-amplify/ui/dist/esm/index.js
This is the code I have:
HTML
<amplify-authenticator [services]="services" initialState="resetPassword"></amplify-authenticator>
TS
this.services = {
async handleForgotPasswordSubmit(formData): Promise<void> {
const { username, code, password } = formData;
return Auth.forgotPasswordSubmit(username, code, password)
.then(res => {
// Do something on success
})
.catch(err => {
// The ERROR is here
console.log(err);
});
}
};
Please advise what can I do to avoid the form freeze problem. Thanks!