-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ServerPermissionsChanged Error when CustomUserData changes #6277
Comments
@aureosouza I just made some updates to one of our examples which includes a very similar use case to what you are describing. |
@takameyer thanks a lot for the support and providing the examples, we had a careful look at the code and if we understand correctly, as a workaround we would have to trigger a client reset using e.g. an Atlas function to manually delete the _realm_sync${context.app.id} database for that ownerId, together with the We believe this bug might be solved on the client side, because this is working smothly in version 11.9.0 and started breaking in version 12. Let us know if we can provide anything to help investigate and find a solution for this. |
@aureosouza We have recently made a fix to ensure we match up with the docs. On our original v12 release, it was assumed that this default client reset mode was happening in core, which was false. We have now set the default to |
@takameyer thanks for that but we just upgraded to latest 12.3.1 but still we are getting ServerPermissionsChanged Error in the logs in App Services after we update the custom user data. Do we still need to trigger manually a client reset using e.g. an Atlas function to manually delete the _realm_sync${context.app.id} database for that ownerId? |
@aureosouza You'll need to call |
@takameyer yes we should be already doing that, and it is working fine on version 11, but does not work on version 12, let us know if the following code is missing anything: await user.refreshCustomData();
realm.syncSession.pause();
realm.syncSession.resume(); Do we still need to call a similar function as your example |
Hi @aureosouza, Refreshing Session: One difference between our example code that @takameyer linked to and the code example you just provided is that we are calling Both You could try a similar approach to see if your syncing starts working again. But perhaps something faster to try first is to set rerunOnOpen: true in your sync configuration for initial subscriptions. Without knowing how your subscriptions are set up, you can always compare with our example as we use the strategy of subscribing to all objects of a certain type, then letting the backend permissions determine what gets synced to the device. ServerPermissionsChanged: I believe this error will still show (in the App logs) when the permissions are changed, but once the above client updates have been made, syncing should work again with the new permissions. Trigger Client Reset:
No, that function is only used for demo purposes and should not be used in production. |
@elle-j thanks a lot for the support we tried the approach using the listeners to have a sync behaviour between pause and resume functions and it helped initially, but when changing a couple of times the custom user data we are getting error on mobile:
One reminder that might help with investigation is that everything was perfect on version 11.9.0, so the backwards compatibility was not respected on new version 12 for the realm mobile. That's the reason we are not upgrading yet, please let us know if we can help provinding anything else, thanks again. |
@aureosouza We have a number of fixes to client reset in recent version. Not that they seem to be related but worth to mention. |
@kneth we just updated to latest 12.6.0 and scenario is the same, when we change the CustomUserData used in a rule for the 2nd time we get on mobile:
And on server logs:
Reminder this does not happen on version 11, we will try to investigate the issue to help with a PR fix for this, let us know if there are any insights on this to help solving the issue, thanks. ![]() |
With v12.6.0 you probably don't want to do pause()/resume() as it might cancel the client reset. |
@kneth Perfect! Removing pause and resume functions worked like a charm in version 12.6.0, I guess the reset is happening automatically on this version. Changing custom user data that depends on rules, now triggers the sync session correctly. Closing issue. |
How frequently does the bug occur?
Always
Description
If we update the CustomUserData the device sync stops working on version 12.3.0 (on version 11.9.0 it works fine). We have a sync role under AppServices in Atlas Rules for one collection that depends on CustomUserData. It's a quite common scenario to update the CustomUserData and allow syncing of new data and this was working fine on 11.9.0. But we are not not able to upgrade to version 12.3.0 as this is not working anymore, we always get ServerPermissionsChanged error on Atlas logs side.
Stacktrace & log output
No response
Can you reproduce the bug?
Always
Reproduction Steps
Version
12.3.0
What services are you using?
Both Atlas Device Sync and Atlas App Services
Are you using encryption?
No
Platform OS and version(s)
iOS 16
Build environment
"react-native": "0.71.8",
Cocoapods version
No response
The text was updated successfully, but these errors were encountered: