Refresh Custom User Data within Atlas Function

Hi, I am using Atlas App Services with Atlas Functions and Rules/Role based permissions. The Rules rely on the current state of users’ Custom User Data.

In my Atlas Functions which run on the Atlas server I modify the users’ Custom User Data by update calls to the collection in which it is stored, which should change the permissions they have to other data. However, the Custom User Data is not automatically refreshed, so the updated permissions are not reflected by the Rules for some time.

Within an Atlas Function, how can I force a refresh of the Custom User Data so that Rules are applied with the new permissions immediately? I have seen the Realm API call refreshCustomData, but don’t know how I can call this from within an Atlas Function where my access to the user’s data is via context.user.custom_data, as documented here.

I am not using a realm sync session; my app is a React browser app.

As background, this post is related, but doesn’t specifically answer my question. There is also this related issue I’ve found.

Thanks