'Metadata Realm encryption was specified, but no encryption key was provided.'

var credentials = Credentials.UsernamePassword(RealmConnectionInfo.Username, RealmConnectionInfo.Password, false);
var admin = await Realms.Sync.User.LoginAsync(credentials, new Uri(RealmConnectionInfo.LoginUri));

After the recent update to realm 4.3.0 I get the Metadata Realm encryption specified error on attempting LoginAsync. Reverted to 4.2.0 and the error persisted. Restored project from previous commit and error persisted. No changes have been made to the login code since the beginning of the project. This seems very similar to this bug on github: https://github.com/realm/realm-dotnet/issues/1956.

As some background info, this is a windows service project I am setting up to import data from a realm cloud. .Net Framework 4.6.1(also tested on 4.7.2). Realm version 4.3.0 latest stable and tested in reversion to 4.2.0 as well.

@Ryan_Ziegler Per the follow-up issue you created on GitHub realm-dotnet:#1967, this was confirmed as a bug.

Quoting the relevant comment from one of the Realm .NET engineers:

This is a 4.3.0 bug, unfortunately. You need to do a complete clean of your project (delete bin and obj folders) for NuGet to correctly update the native libraries included in your project when you’re downgrading.

You can either downgrade to 4.2.0 (if you clean your project), or work around this by calling Realms.Sync.SyncConfigurationBase.Initialize (Realm.Sync.UserPersistenceMode.NotEncrypted) at the start of your application. This should be the default behavior on non-Apple platforms, but due to a bug user metadata encryption is forced even on platforms where it’s not automatically applicable.

Regards,
Stennie

1 Like