Getting “TypeError: user.getIdToken is not a function” when updating password in firebase

When I run the function updatePassword I get the error “TypeError: user.getIdToken is not a function”, which comes from a file in the firebase sdk.

async changePassword(state, payload) {
      const user = auth.currentUser
      let cred = EmailAuthProvider.credential(
        payload.email,
        payload.oldPassword
      )

      reauthenticateWithCredential(user, cred)
        .then(() => {
          // User re-authenticated.
          console.log(payload.newPassword)
          updatePassword(payload.email, payload.newPassword)
            .then(() => {
              // Update successful.
              console.log('Succeed')
            })
            .catch((error) => {
              console.log('Failed', error)
              // An error ocurred
              // ...
            })
        })
        .catch((error) => {
          // An error ocurred
          // ...
          console.log(error)
        })
    },