on my iOS program. About half the time this function just never comes back. I used work fine up until this morning. I tried this on a new app and new cluster - same problem.
func initRealms(onCompletion completion: @escaping (Error?) -> Void) {
if let user = self.app.currentUser,
let uid = self.currentUserId {
// open user realm
Realm.asyncOpen(configuration: user.configuration(partitionValue: "user_id=\(uid)")) { result in
switch result {
case .success(let realm):
self.userRealm = realm
Realm.asyncOpen(configuration: user.configuration(partitionValue: "public")) { result in
switch result {
case .success(let realm):
self.publicRealm = realm
completion(nil)
case .failure(let error):
fatalError("Failed to open public realm: \(error)")
}
}
case .failure(let error):
fatalError("Failed to open user realm: \(error)")
}
}
}
}
Up until this morning, this code worked absolutely fine. It now hangs on the first asyncOpen() and never comes back intermittently, but about 80% of the time.
I have bundled Swift Package Dependencies Realm 10.5.1 and RealmDataBase 10.3.3
I have also tried this on a brand new cluster and application - same problem.
Yes it could fail if you can’t unwrap user, but right now it’s failing on the asyncOpen() - it just does not come back. This only started happening this week, and it’s intermittent to boot.
My issue with asyncOpen() has magically stopped happening - maybe the server gods have decided to smile on me again. It might have something to do with the fact that it is 2AM here on East Coast - in the pandemic time is but a mere illusion. Speaking of your topic Jay, what was your issue with?
if let user = self.app.currentUser,
let uid = self.currentUserId {
Now you have peaked my curiosity. In my code, I define currentUserId as
var currentUserId: String? {
if let user = self.app.currentUser {
let uid = user.id
return uid
}
return nil
}
The issue we had was due to another coding error, which was caused by the app crashing somewhere ‘in the middle’ and currentUser was still populated but was not authenticated.
It would fail silently and we had to figure out why - just adding some else statements with error handling took care of that - no biggie.
The comment was more for troubleshooting than anything.
I’m having the same issue. Without any modifications on the client or the server, Realm.GetInstanceAsync (C#) is hanging (it actually returns after 5 minutes or so if I remove the timeout).
This happened last Friday, yesterday and now today.
I spoke too soon, it happening to me again tonight at 7PM EST. I will wait 5 minutes to see if it comes back. I am going to build a super simple Realm app, where this happens, and post it to the forum for further examination.
So I have essentially condensed this down a 10 line Realm Swift program on a fresh MongoDB Realm app and Atlas cluster. It hangs every time on asyncOpen. I published a public GitHub repo for anyone to try this out.
Currently this is built against a MongoDB app with a Realm Id of
REALM_APP_ID = "hangingapp-lxnaw"
There is one user called john@doe.com with a password “mongodb”. The app is configured with a simple Email/Password authentication.
This definitely seems like a server problem from the latest deploy.
I tested the project a few times now and I see the same issue. Sometimes it actually works as it should returning in 4 or 5 seconds, but most of the time it takes more than 3 minutes.
@Luccas_Clezar there is definitely something going on that’s new. This was not happening until Friday consistently - then again I wasn’t programming Wednesday or Thursday - doing documentation work instead. The example that I published is as basic as it gets.