# Update a User : Failed Change Password : "Cannot read property 'n' of undefined"

**URL:** <https://community.auth0.com/t/update-a-user-failed-change-password-cannot-read-property-n-of-undefined/95754>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [December 6, 2022, 4:46am UTC](https://community.auth0.com/t/update-a-user-failed-change-password-cannot-read-property-n-of-undefined/95754 "2022-12-06T04:46:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rec-x](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rec-x/32/33507_2.png) [@rec-x](https://community.auth0.com/u/rec-x)\
**Post date:** [December 6, 2022, 4:46am UTC](https://community.auth0.com/t/update-a-user-failed-change-password-cannot-read-property-n-of-undefined/95754/1 "2022-12-06T04:46:23Z")

</div>

> **[Auth0 Management API v2](https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id)**

Not working with valid user ID is passed and JSON body:  
{“password”:“sampleNewPassword”,“connection”:“Username-Password-Authentication”}

Response Body:  
{  
“statusCode”: 400,  
“error”: “Bad Request”,  
“message”: “Sandbox Error: undefined”  
}

Dashboard Log:  
Type: Failed Change Password  
Description: Cannot read property ‘n’ of undefined

Please advise?

---

<div class="post-metadata">

**Author:** ![lihua.zhang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lihua.zhang/32/39683_2.png) [@lihua.zhang](https://community.auth0.com/u/lihua.zhang)\
**Post date:** [December 8, 2022, 7:59pm UTC](https://community.auth0.com/t/update-a-user-failed-change-password-cannot-read-property-n-of-undefined/95754/3 "2022-12-08T19:59:03Z")

</div>

Hi @rec-x ,

Welcome to the Auth0 Community!

The body scripts you use looks correct to me. I tested this endpoint with Postman, and it works.

I am happy to look further into this if you can DM me the name of the tenant and the email of the user.

Thanks!

---

<div class="post-metadata">

**Author:** ![lihua.zhang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lihua.zhang/32/39683_2.png) [@lihua.zhang](https://community.auth0.com/u/lihua.zhang)\
**Post date:** [December 26, 2022, 5:30pm UTC](https://community.auth0.com/t/update-a-user-failed-change-password-cannot-read-property-n-of-undefined/95754/4 "2022-12-26T17:30:40Z")

</div>

Hi @rec-x ,

Thank you for DM me your tenant and user email.

In your tenant, the Username-Password database connection has the custom database enabled. As per [this](https://auth0.com/docs/manage-users/user-accounts/user-profiles/update-user-profiles-using-your-database#update-users-with-the-management-api) article, only the following three fields can be updated using Management API for the custom database.

- `app_metadata`
- `user_metadata`
- `blocked`

And If you need to update other user fields, you will need to do it directly in your database.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [January 9, 2023, 5:31pm UTC](https://community.auth0.com/t/update-a-user-failed-change-password-cannot-read-property-n-of-undefined/95754/5 "2023-01-09T17:31:25Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
