[SOLVED] TypeError: Cannot read properties of undefined (reading 'requestPasswordReset')

I’m trying to reset the user’s password in my react-moralis app. I have the latest version of Moralis. Here’s my code:

const Reset = () => {
  const { Moralis } = useMoralis();
  const [email, setEmail] = useState('');

  return <div>
    <Form.Control className="mt-4" placeholder="Email" value={email} onChange={(event) => setEmail(event.currentTarget.value)} />
    <Button className="mt-3"
        onClick={() => {
          Moralis.user.requestPasswordReset(email)
            .then(() => {
              alert("Password request successfull, please check your Email!");
            })
            .catch((error) => {
              alert("Error:" + error.code + " " + error.message);
            });
        }}
      >
        Request Password Reset
      </Button>
  </div>
}

After typing the email and clicking the button, I’m getting ā€œTypeError: Cannot read properties of undefined (reading ā€˜requestPasswordReset’)ā€ error. What could be the reason?

You can try Moralis.User instead of Moralis.user

1 Like

This worked, thanks! :slight_smile: