Skip to content
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

RealmException: Realm at path '/path/to/default.realm' already opened with different sync configurations. Error code: 2013 #1812

Open
SankaraveluS opened this issue Dec 12, 2024 · 0 comments

Comments

@SankaraveluS
Copy link

What happened?

I'm facing an issue when using Realm with flexible sync and disconnected sync configurations. I initialize the flexibleSync on the main thread and disconnectedSync on a background thread (using the workmanager package), and I encounter the following error:

RealmException: Realm at path '/path/to/default.realm' already opened with different sync configurations. Error code: 2013

Repro steps

Main Thread (Flexible Sync Initialization):
final config = Configuration.flexibleSync(
loggedInUser,
[
Model.schema,
],
path: Configuration.defaultRealmPath,
syncErrorHandler: (SyncError error) {
debugPrint("Error message: ${error.message}");
},
);

Realm realm = Realm(config);

On WorkManager Callback Function (Disconnected Sync Initialization):
final config = Configuration.disconnectedSync(
[
Model.schema,
],
path: Configuration.defaultRealmPath,
syncErrorHandler: (SyncError error) {
debugPrint("Error message: ${error.message}");
},
);

Realm realm = Realm(config);

Problem
The workmanager callback is called whenever I submit my form, and I get the error mentioned above: RealmException: Realm at path '/path/to/default.realm' already opened with different sync configurations. Error code: 2013.

Version

3.4.1

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

Android v21

Code snippets

No response

Stacktrace of the exception/crash you're getting

RealmException: Realm at path '/path/to/default.realm' already opened with different sync configurations. Error code: 2013

Relevant log output

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant