auth0 / node-auth0

Node.js client library for the Auth0 platform.
MIT License
628 stars 307 forks source link

ManagementApiError.errorCode is undefined when trying to update the password of a user #951

Closed alaczi closed 11 months ago

alaczi commented 11 months ago

Checklist

Description

Using ManagementClient.users.update to change a user's password using the same password as the user's current password throws an error, but the errorCode property in the emitted error is undefined. According to the definition of the error it can't be undefined.

Either change the definition of ManagementClientError.errorCode to allow undefined value or return set the errorCode to a valid string value.

Reproduction

1, create a user with a password 2, use the management api user's manager to update the user's password using the current password

    try {
      await managementClient.users.update(
        {
          id: "auth0|{your-user-id},
        },
        { password }
      );
    } catch (err) {
    // inspect the error
    }

3, inspect the error instance

Screenshot 2023-10-10 091822

Additional context

No response

node-auth0 version

4.0.1

Node.js version

20.8

frederikprijck commented 11 months ago

Thanks for reporting, I can reproduce this and will look into how we want to proceed.