Realm Sync: noMatchingRole

I am pretty new to Realm Sync. I already configured my app roles based on GitHub - mongodb-university/realm-tutorial-backend. But then when I tried some GraphQL queries, I got nothing at all. I checked Realm’s Logs and got these Rule Performance Metrics:

{
  "namespacesMetrics": {
    "crowdfinder.user": {
      "roles": {},
      "noMatchingRole": 1
    }
  }
}

My app is crowdfinder-dgpws. I don’t know what I am missing since all of the configuration (aside from some app-specific variables) are exactly the same as the tutorial.

Hello @mangkoran,

Thank you for reaching out. Your App has Sync enabled. When you have Sync enabled on your app, then Sync Permissions will take precedence over MongoDB Roles.

Your Read permissions are followed for GraphQL Reads while Mutations, Creates or Updates happen as per the Write Permissions.

I hope this clarifies. Please let us know if you have any more questions.

Kind Regards,
Henna

1 Like

Hello both,

We happened to have a very similiar issue now with our data setup correctly and working on one environment but not working on another. We’ve checked the sync settings and rules, both environments do not have any explicit rules.

However, the previous environment does not hit this noMatchingRoles issue wherase the new environment does (According to the logs for our graphql queries)

Is there any other course of action/diagnostics to go through?

Hello @Oliver_Tan,

Welcome to the Community Forums :smiley:

I noticed you have multiple cloud projects. Could you please help me know Realm App names for both the working and non-working environments?

I look forward to your response.

Kind Regards,
Henna

Hello Henna,

Sorry for the late response. We’ve contacted the mongo support team to try and resolve the problem but ended up never finding out what was the cause. What we did instead (As the application was not live yet) was to delete the existing non-functioning environment and duplicate the existing one that does work and adjusting configs as necessary. That seemed to work for whatever reason.

Thanks

Hello Oliver,

Thanks for sharing the information. Sync roles and permissions do work differently and take precedence when you have Sync enabled on the cluster. Check the Sync Rules section of our documentation.

For future reference, I would suggest if you could create a duplicate environment without deleting the non-functioning one and that would help us identify if there is an internal issue causing the problem.

Thank you for your collaboration with us :smiley:

Please don’t hesitate to ask or create a post if you have more questions.

Cheers,
Henna