# Unable to update user profile from fetchUserProfile script

**URL:** <https://community.auth0.com/t/unable-to-update-user-profile-from-fetchuserprofile-script/79827>\
**Category:** Get Help\
**Created:** [March 14, 2022, 11:27am UTC](https://community.auth0.com/t/unable-to-update-user-profile-from-fetchuserprofile-script/79827 "2022-03-14T11:27:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![amalina](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/amalina/32/35843_2.png) [@amalina](https://community.auth0.com/u/amalina)\
**Post date:** [March 14, 2022, 11:27am UTC](https://community.auth0.com/t/unable-to-update-user-profile-from-fetchuserprofile-script/79827/1 "2022-03-14T11:27:14Z")

</div>

Hi Auth0 community! I recently ran into an issue with updating user `app_metadata` from the  
`fetchUserProfile` script. I had a custom social connection which was storing additional data about users in `app_metadata`. This approach was working well until I added a new rule that was also performing some operation on `app_metadata` by calling the `auth0.users.updateAppMetadata` method. As soon as that method was called from the rule, my `fetchUserProfile` script was no longer able to perform updates on `app_metadata`. I found [this note](https://auth0.com/docs/manage-users/user-accounts/metadata#manage-metadata) in docs that it’s not recommended to populate `app_metadata` from `fetchUserProfile`. It doesn’t elaborate why, but I assume it’s to avoid issues such as the one I encountered.

I searched for potential solution to this issue and found [PATCH user.app\_metadata isn't behaving as documented](https://community.auth0.com/t/patch-user-app-metadata-isnt-behaving-as-documented/7431) which seemed to be related to issue I was observing because `auth0.users.updateAppMetadata` method is performing `PATCH` operation under the hood. The solution from this thread suggested storing user data in custom property. It worked well at first glance, as I was seeing updates being reflected in Auth0 UI (new property showed up in `Identity Provider Attributes` section). However, despite that change being reflected in UI my rules were still getting outdated version of this custom property. Similarly to `app_metadata` property as soon as `auth0.users.updateAppMetadata` method was called that property was somehow “cached” in rules and no updates from `fetchUserProfile` script were picked up from rules.

Do you have any advice on how to properly store (and be able to update) custom user profile data via `fetchUserProfile` script?

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [March 15, 2022, 11:31am UTC](https://community.auth0.com/t/unable-to-update-user-profile-from-fetchuserprofile-script/79827/4 "2022-03-15T11:31:27Z")

</div>

Hey there @amalina !

We saw that you already contacted our developer support team with the same questions. I hope you’ve already received their support! Let us know if we can help anyhow down the road and it will be great if you can share later what our developer support team suggested, for the benefit of others! Thank you!

---

<div class="post-metadata">

**Author:** ![renato](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/renato/32/33771_2.png) [@renato](https://community.auth0.com/u/renato)\
**Post date:** [June 3, 2022, 1:10pm UTC](https://community.auth0.com/t/unable-to-update-user-profile-from-fetchuserprofile-script/79827/5 "2022-06-03T13:10:16Z")

</div>

Hi @amalina . I have exactly the same problem. Did you manage to make it work?

---

<div class="post-metadata">

**Author:** ![amalina](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/amalina/32/35843_2.png) [@amalina](https://community.auth0.com/u/amalina)\
**Post date:** [June 3, 2022, 1:26pm UTC](https://community.auth0.com/t/unable-to-update-user-profile-from-fetchuserprofile-script/79827/6 "2022-06-03T13:26:53Z")

</div>

Hi @renato ,

Yes, I got the response via Auth0 developer support. They suggested to use `metadata` object to move such data. As far as I understood this is a 3rd type of metadata object supported by Auth0, although they don’t mention it in their docs.

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [June 3, 2022, 10:46pm UTC](https://community.auth0.com/t/unable-to-update-user-profile-from-fetchuserprofile-script/79827/7 "2022-06-03T22:46:21Z")

</div>

@amalina Glad to hear that developer support was able to get this resolved for you!

For @renato and future community members who might run into this - The workaround is setting a ‘metadata’ object instead of ‘app\_metadata’ in the Fetch User Profile script.

Cheers!

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [June 18, 2022, 10:46pm UTC](https://community.auth0.com/t/unable-to-update-user-profile-from-fetchuserprofile-script/79827/8 "2022-06-18T22:46:37Z")

</div>

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