Realm LogIn error


#1

I am getting an exception when calling Realm.asyncOpen()

Can anyone explain what this error means ?

HTTP response: 0e894b86-a401-4cb3-8a24-4ca750301030 {"type":"https://realm.io/docs/object-server/problems/invalid-realm-type","title":"The type of the Realm file was invalid.","status":400,"code":619}

The Swift error codes are as follows:

Error: Operation canceled io.realm.sync Error Domain=io.realm.sync Code=4 “Operation canceled” UserInfo={NSLocalizedDescription=Operation canceled, statusCode=89}


#2

TL;DR: you’re trying to connect with partial: true to a Realm that was created as non-partial, or you’re trying to do a full sync to a Realm that was created with partial: true.

Longer explanation below…

Realm provides two synchronization types - query-based (formerly known as partial) and “full”.

With query-based synchronization you only synchronize objects that match the queries you’ve defined. This mode comes with fine-grained permissions that allow to control access at the object level.

The “full” mode synchronizes the entire Realm file and comes with path level permissions.

When you create a Realm, it is created either as a reference or a full Realm depending on how it gets created. If you connected in “full” mode, it gets created as a “full” Realm and path-level permissions apply. If you connected in query-based (partial) mode by setting partial: true in your config, it will be created as reference Realm and fine-grained permissions will apply.

Once a Realm is created in either of these modes, it generally cannot switch to the other as that could expose it to security vulnerabilities (e.g. you thought you had protected it by applying restrictive fine-grained permissions but someone connects in “full” mode and downloads the entire Realm). That being said, in the next version of Realm Studio, we’ll ship functionality to change the type of the Realm in case you accidentally created it in the wrong mode.

Keep in mind that admin users can still open reference Realms in “full” mode as they have full control over the server and applying restrictions for them doesn’t make sense.


#3

OK, that might explain it. How do I create a ‘partial’ realm with Realm Studio or is that not possible?


#4

That is not possible, you have to first connect with a device.


#5

@nirinchev How does one handle migrations of clients who have connected with “full” mode if new code is being written with the “reference” Realm API in mind?