Closed Rashmi-278 closed 3 years ago
after typing in proper credentials , we get this error
Unhandled Runtime Error Error: Objects are not valid as a React child (found: object with keys {code, name, message}). If you meant to render a collection of children, use an array instead. in div (created by ForwardRef(Alert)) in div (created by ForwardRef(Paper)) in ForwardRef(Paper) (created by WithStyles(ForwardRef(Paper))) in WithStyles(ForwardRef(Paper)) (created by ForwardRef(Alert)) in ForwardRef(Alert) (created by WithStyles(ForwardRef(Alert))) in WithStyles(ForwardRef(Alert)) (at Layout.tsx:16) in Alert (at Layout.tsx:68) in Transition (created by ForwardRef(Grow)) in ForwardRef(Grow) (created by ForwardRef(Snackbar)) in div (created by ForwardRef(ClickAwayListener)) in ForwardRef(ClickAwayListener) (created by ForwardRef(Snackbar)) in ForwardRef(Snackbar) (created by WithStyles(ForwardRef(Snackbar))) in WithStyles(ForwardRef(Snackbar)) (at Layout.tsx:67) in Layout (at register.tsx:46) in Register (at withNotAuthenticated.tsx:12) in WithNotAuthenticated (at withRedux.tsx:13) in Provider (at withRedux.tsx:12) in withRedux(WithNotAuthenticated) (at _app.tsx:34) in Page (at _app.tsx:33) in MyApp in ErrorBoundary (created by ReactDevOverlay) in ReactDevOverlay (created by Container) in Container (created by AppContainer) in AppContainer in Root
SOLUTION :
In file pages/api/register.ts
there is an issue with creating a new attribute in cognito userpool
refer these to solve it , https://stackoverflow.com/questions/44013901/amazon-cognito-a-client-attempted-to-write-unauthorized-attribute
OR
just comment out the line ,
new CognitoUserAttribute({Name: "custom:timestamp", Value: Date.now().toString()})
to
//new CognitoUserAttribute({Name: "custom:timestamp", Value: Date.now().toString()})
When sigining up as a new user , the password was incorrectly validated. for example : Email : fsluwlsehitpflvlry@avxrja.com Password : G$k!4ErZ9Ky.M9j Confirm Password : G$k!4ErZ9Ky.M9j ERROR THROWN : Must Contain 8 Characters, One Uppercase, One Lowercase, One Number and one special case Character
The above error was solved when password matched the regex string
Regex in RegisterForm.tsx /^(?=.[A-Za-z])(?=.\d)(?=.[@$!%#?&])[A-Za-z\d@$!%*#?&]{8,}$/,