Sync error: Client attempted a write that is not allowed

I am using the C++ SDK, and hitting this sync error:

Client attempted a write that is not allowed; it has been reverted

I have checked all permissions in Atlas Device Sync.

Is there something I am missing?

These are the roles for the collection:

{
  "roles": [
    {
      "name": "readAndWriteAll",
      "apply_when": {},
      "document_filters": {
        "write": true,
        "read": true
      },
      "read": true,
      "write": true,
      "insert": true,
      "delete": true,
      "search": true
    },
    {
      "name": "readAllWriteOwn",
      "apply_when": {},
      "document_filters": {
        "write": {
          "owner_id": "%%user.id"
        },
        "read": true
      },
      "read": true,
      "write": true,
      "insert": true,
      "delete": true,
      "search": true
    }
  ]
}

Hi @Adam_Wilson,

If you’re using Flexible Sync, this message can be raised also when the change would bring the object outside the subscriptions that you’ve set. Say, you’ve subscribed to objects in a collection with the query flag == true, but you’re writing an object with flag set to false.

Thank you for the quick reply.

I’ve now changed my subscription to sync all objects, similar to the SDK example

auto updateSubscriptionSuccess = syncedRealm.subscriptions().update([](realm::mutable_sync_subscription_set &subs) {
    subs.add<Dog>("dogs");
}).get();

However I still get this error, and writes are being reverted.

Is there something else I might be missing?

I found the issue - I was using the wrong App ID. Somehow I was working on a different application config. Not sure when that changed. Anyhow, those errors are now gone!