Migration to Cloud using javascript script appears to complete but no data is showing up in the realm cloud database

Can anyone provide any guidance here - I have used the javascript previously to migrate a database file to the cloud service and don’t recall having any problems. We are just preparing for the upgrade to RealmSwift 5.2.0 and are having trouble loading a copy of the database into a test environment.

he script appears to login in just fine and completes the migration from the local fine with no errors but there doesn’t seem to be any data showing up in the realm when opened with Realm Studio.

Can’t think what we might have done wrong. Is there any way to check on the cloud service whether the client connected and started the sync?

@Duncan_Groenewald We will need more information to help - like SDK versions, new or old product, code snippets, and some logs - preferably with trace or debug enabled.

Sorry my bad - the script was picking up and old version of the file which had a different server url in it !!

And thanks for the prompt response :slight_smile:

Ian - we are seeing some new (strange) behaviour when using 5.2.0 now that doesn’t make a lot of sense. We use quite a lot of background threads for processing of reports etc. and for some reason now we are seeing a lot of failures when doing realm.objects(XXX.self).filter("id == %@, id) - which returns nil but when doing a listing of the results of realm.objects(XXX.self) we get a complete list of all the expected objects.

Is there some change in behaviour in RealmSwift 5.2.0 that might be cause a problem with realm queries - or any known bugs that we might be unaware of ? We have been using RealmSwift 4.4.1/macOS 10.15 with no problems but figure we should upgrade in preparation for an eventual migration to Mongo Realm.

I am puzzled as to how something like the following can return nil

let items = realm.objects(Item.self)

// This correctly lists all items
for item in items {
   print("item: \(item.id), \(item.name)"
}

// and this always returns nil
let item = realm.object(ofType: Item.self, forPrimaryKey: id)
print("item: \(item?.id), \(item?.name)")

We will continue to investigate but if anyone has encountered anything like this before please let me know.

We do make extensive use of operation queues but have never had an issue in the past so unless there is some change between SwiftRealm 4.4.1 and 5.2.0 that may cause problems when using operation queues I can’t see why we should suddenly be encountering any problems.

The example above is on consecutive lines in the same function call so even with operation queues I would expect that would be executed on the same thread so I can’t think switching threads of execution could be the reason for the problems now.

One of the function calls that fails with 5.2.0 is the following:

Realm.asyncOpen(configuration: self.realmSyncConfig, callbackQueue: .global()) { (realm, error) in
            completion(realm, error)
        }

So has to be changed to the following:

Realm.asyncOpen(configuration: self.realmSyncConfig, callbackQueue: .main) { (realm, error) in
            completion(realm, error)
        }

Are there release notes for 5.2.0 that explain why this change is necessary ?

Yes the issue is described here - https://github.com/realm/realm-cocoa/issues/6672#issuecomment-667411833

We are currently investigating. Feel free to follow the issue