SessionException on GetInstanceAsync() for Xamarin.Android


#1

Hi,
I’m developing an app with Xamarin.Android and Realm Cloud. I’m able to create/login a user, but I keep getting Session Exception right after calling GetInstanceAsync().

SessionException details:
Message: “Unknown OpenSSL error: 336134278”
ErrorCode: 336134278

IDE: Visual Studio 2017 Pro (Windows 10)
Tested on: Emulator (Android API 27) and Real device - Nexus 5 (Android API 23)
Xamarin.Android SDK Version: 8.3.0.19
Realm and Realm.Database Nuget versions: 3.0.0

var user = await User.LoginAsync(Credentials.Nickname("User1", true), new Uri("https://MY-INSTANCE.cloud.realm.io/auth"));
RealmConfiguration.DefaultConfiguration = new SyncConfiguration();
Session.Error += ((object sender, ErrorEventArgs e) =>
{
    var sessionException = (SessionException)e.Exception;
});
var realm = await Realm.GetInstanceAsync();

#2

OpenSSL on Android doesn’t use the device keystore by default which is why the certificates cannot be validated. We’re going to release a fix for this in the near future, but until that happens, you can set EnableSSLValidation = false on the SyncConfiguration instance.