I haven’t used Realm since before it was acquired by MongoDB, so I might be missing some concepts to make things work.
When trying to connect using the Swift SDK on a macOS app using Flexible Sync, I’m getting the following errors looped in my console log:
Info: Connection[1]: Connecting to 'wss://ws.us-east-1.aws.realm.mongodb.com:443/api/client/v2.0/app/memory-fuaet/realm-sync'
Info: Connected to endpoint '34.227.4.145:443' (from '192.168.68.58:65319')
Info: Connection[1]: Closing the websocket with error code=WebSocket: OK, message='', was_clean=true
Error: Reading failed: End of input
Info: Connection[1]: Closing the websocket with error code=WebSocket: Read Error, message='End of input', was_clean=false
Info: Connection[1]: Connection closed due to transient error: ConnectionClosed: End of input
When looking in the Atlas console I’m seeing the following error:
error handling “bind” message: error getting sync status from metadata store: error getting initial sync status: mongo: no documents in result
My code is straightforward, and even though login succeeds, seems that actually opening sync is failing:
let app = RealmApp(
id: realmConfig.appId,
configuration: AppConfiguration(baseURL: realmConfig.baseUrl, transport: nil)
)
let user = try await app.login(
credentials: .emailPassword(
email: ...,
password: ...
)
)
// login is successful and im getting a valid user here
var config = user.flexibleSyncConfiguration(
clientResetMode: .recoverOrDiscardUnsyncedChanges()
)
config.objectTypes = [Tag.self]
let realm = try await Realm(
configuration: config,
downloadBeforeOpen: .once
)
Tag looks like this:
public class Tag: Object {
@Persisted(primaryKey: true) public var _id: ObjectId
@Persisted public var name = ""
@Persisted public var ownerId: String
public convenience init(name: String, ownerId: String) {
self.init()
self.name = name
self.ownerId = ownerId
}
}
Things I’ve tried:
- In Data Services → Database, tried to create my database with the relevant model with a dummy piece of data
- In App Services → Schema, I’ve tried defining the schema by hand to match the Database model
- I looked in Queryable Fields and things seem right…
Any pointers / guidelines would be immensely helpful.
Thanks!