-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Unable to open realm on background isolate #1433
Comments
Hey @geosebas, thanks for the report here. There were some changes related to how users are handled under the hood and it's possible we've hit a regression there. I'll try to come up with a repro case in a test based on the issue description, but if I fail to prepare one, I'll reach back to you for pointers. |
Hey @geosebas, I was able to reproduce this and it turns out it never really worked as it should have and if it did, it was by accident. The changes in #1445 don't fix it as much as introduce a different - and reliable - way of opening Realms on a background isolate. So instead of reconstructing the app on the background isolate, you'd need to first construct the // On the main thread
final appId = 'my-app-abcde';
final app = App(AppConfiguration(appId));
// Later
await Isolate.spawn((List<Object> args) async {
final app = App.getById(appId);
final user = app.currentUser!;
final realm = Realm(FlexibleSyncConfiguration(user));
// use realm as usual
}); |
As new release was published I was referring to your example Realm(FlexibleSyncConfiguration(user)); but I get the error The class 'FlexibleSyncConfiguration' doesn't have an unnamed constructor. should we open it as normal |
Hey @richard457, you're right - I was typing that directly on Github and seem to have mixed up some C# in there. You should indeed use |
I am uploading the video to api.video using theirs uploader plugin . video_uploader . They are using Workmanager to upload the video on background . So when, I initialize the upload process, then terminate the app, (video continues to upload ) and then I try to reopen the app. I am getting ::
Is there anyway I can handle this ? |
Can you create a new issue and share the code snippets you're using to open the Realm file? |
Hello @nielsenko, hope you're well. Everything is working well on my side, in fact too well ^^ |
@geosebas Unless you setup a listener on final subscription = Realm.logger.onRecord.listen((event) {
print('$event');
}); (of the top of my head).. But yes, you should use |
Oh I didn't know about this ! Thanks for the help :) |
What happened?
Code that worked and still work on realm 1.5.0 stop working since update. I downgraded for now, so it's not urgent.
I currently don't have time to create a sample and test sample with the new version, but since it work nicely on 1.5 and not with 1.6 and I didn't see anything on the changelog related to this, I assume the problem here is on your side.
Repro steps
Nearly a years ago I got the same problem (issue here #1055)
Version
Flutter 3.16.0
What Atlas Services are you using?
Both Atlas Device Sync and Atlas App Services
What type of application is this?
Flutter Application
Client OS and version
With realm 1.6.0 on both android and ios
Code snippets
No response
Stacktrace of the exception/crash you're getting
Relevant log output
No response
The text was updated successfully, but these errors were encountered: