"Realm Not Configured Correctly" Error when Running a Realm Client Reset

I am getting this error when trying to run a client reset for a realm. Anyone experience anything like this? I can’t find any information. The code is fairly standard, taken from the ReactNative SDK documentation.

"Error: Realm was not configured correctly. Client Reset could not be run for Realm at: "

ReactiveNative 0.64.1
Realm 10.4.2

This is a function that fires to (not directly a function on the sync error handler, as the error handler does not have access to “realm”, so cannot close it.) This function takes in a realm instance, and the path names from the ClientReset error.

export default handleRealmClientResetError = (realm, originalFilePath, recoveryFilePath, dispatch) => {
  // Close the realm that needs to be reset
  realm.close();

  const appConfig = {
    id: '<appNameHere>',
    timeout: 10000,
  };
  const app = new Realm.App(appConfig);

  try {
    console.log(`Error: ClinetReset, need to reset ${originalFilePath}…`);
    // Initiate the client reset process
    Realm.App.Sync.initiateClientReset(app, originalFilePath);

    console.log(`Creating backup from ${recoveryFilePath}…`);
    // Move backup file to a known location for a restore
    fs.renameSync(recoveryFilePath, originalFilePath + "~");
  }
  catch(error) {
    console.log(error);
  }

  // Discard the reference to the realm instance
  realm = null;

  // Update state so that the backup restore may begin
  dispatch(clientResetCompleteReduxAction(true));
};

Also, I should note that I am able to use & sync data in my Realm, so it appears to be configured correctly. It is only not configured correctly when doing the ClientReset.

I’m not sure if it’s the cause, but I notice you’re creating a new Realm.App instance inside the handler and the app parameter is supposed to be the app which was used to open the Realm originally.

if you’re failing to use the same appId it’ll definitely cause that error.

Hey Ian, thanks for your reply.

That’s wasn’t it, i just redacted the app name when posting here. I also tried using the same app object that I open the realms with (rather than creating another instance) and that didn’t change anything.

I investiaged a lot of different things but nothing ended up working. I validated that all of my app object, user ubjects, and realm objects were exactly what I thought they should be at the time of reset.

I ended up just shelving the task and was going to come back to it. In order to get my app back into working state I proceeded with:
-deleting all configurations from realm (schema/rules)
-deleting all corresponding collections from Atlas
-deleting all local relam files
-terminating sync and restarting sync

After that, without any change to code, its now working. I am now able to get recovered-realms generated through the initiate clientReset process.

Note: I was in developer mode before I deleted everything. Also started sync back up in developer mode. I hadn’t defined any schemas or rules from the Realm web UI.

Edit:

For anyone who ends up here.

When in DeveloperMode the error will likely be resolved from removing the configurations from the schema(s) you’ve modified (from the Atlas/Realm WebPortal), dropping the corresponding collection(s) from Atlas, and then restarting your Realm application.

If that still doesn’t work, then proceed with all of the steps listed above.

1 Like