Error while trying to connect to Realm Platform Self-Hosting

cloud
ros

#1

I am getting the following Exception when I try to access Realm Platform self hosted server.

System.MissingMethodException: void Realms.Sync.User..ctor()
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.10.1.178/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:316 
  at QuickJournal.JournalEntriesViewModel.ConnectToRealm () [0x00013] in <1154c4efe25e44f8ab590af6dcbeb491>:0 
  at QuickJournal.JournalEntriesViewModel..ctor () [0x0005d] in /Users/User/Documents/Xamarin Forms Projects/RealmSampleApp/QuickJournal/ViewModels/JournalEntriesViewModel.cs:70 

Line 70 which throws the error is the ConnectToRealm()…

try{
                ConnectToRealm().ContinueWith(task => {
                    if (task.Exception != null) {/*Error Handling here*/}
                });
            }
            catch(Exception ex)
            {
                Debug.WriteLine("An error has occured while trying to connect to Realm" + ex);
            }

Connect to Realm method is here: ( note that I have connected to another instance which is the cloud one and it’s working fine. But, right now I am trying to access realm on the self hosted service that was created on Azure)

public async Task ConnectToRealm()
        {
            //******************** START Testing on Realm Cloud *************************//
            //Uri authURL = new Uri("https://URL_OF_REALM_CLOUD");
            //Credentials credentials = Credentials.UsernamePassword("USERNAME", "PASSWORD", createUser: false);

            //var user = await User.LoginAsync(credentials, authURL);

            //var serverURL = new Uri("realms://simple-realm-test.us1.cloud.realm.io/~/journal");
            //var configuration = new SyncConfiguration(user, serverURL);
            //configuration.EnableSSLValidation = false;
            //******************** END Testing on Realm server *************************//


            //******************** START Testing on local server *************************//
            Uri authURL = new Uri("http://URL_OF_Self-Hosted_SERVER:9080");
            Credentials credentials = Credentials.UsernamePassword("USERNAME", "PASSWORD", createUser: false);

            User user = new User();
            try
            {
                user = await User.LoginAsync(credentials, authURL);
            }
            catch(Exception ex)
            {
                Debug.WriteLine("Login failed: " + ex);
            }
            var serverURL = new Uri("realm://URL_OF_SERVER:9080/~/journal");
            var configuration = new SyncConfiguration(user, serverURL);
            configuration.EnableSSLValidation = false;

            //******************** END Testing on local server *************************//

            _realm = Realm.GetInstance(configuration);
            _JournalEntries.Clear();

            var journalsFromDB = _realm.All<JournalEntry>();
            foreach(JournalEntry c in journalsFromDB)
            {
                _JournalEntries.Add(c);
                //c.PropertyChanged += (sender, e) =>
                //{
                //    Debug.WriteLine($"New value set for {e.PropertyName}");
                   
                //};
            }

            JournalEntries = new ObservableCollection<JournalEntry>(_JournalEntries);

            _realm.RealmChanged += (s, e) =>
            {
                // Update UI
                Debug.WriteLine("some values have changed");
                RefreshList();
            };
        }

Issue Is occurring on both Android and iOS. All plugins in mobile are up to date except Fody which 2.5.0
Real Object Server version is 1.8.3 and I don’t see any logs or created realms.


#2

I doubled checked that all libraries are updated, deleted bin and obj folders of all projects, restored visual studio and even the Mac.

I also deleted the packages folders and restore them to prevent cached plugins.

The issue is that, I can’t even see which step is giving me the error and there is no log or any useful response.


#3

After I logout and login again in the server, I was able to see the logs.

But I am only getting this error:

sync: no file found for /fd202b1642bf6acbb888cdafa61da9d1/journal


#4

@Alkhamisah Here’s your issue:
Real Object Server version is 1.8.3

that is an old version - please install the latest:
https://docs.realm.io/platform/self-hosted/installation


#5

This is what we get when we follow the guide to install Realm Platform or when I follow this link to install on Mac:

I noticed that in the terminal where the server is running on my Mac the following repetition then crash when I cancel:

2018-06-05T09:44:28.438Z - info: sync: HTTP Connection[145]: Connection from 127.0.0.1:52489
2018-06-05T09:44:28.439Z - info: sync: HTTP Connection[145]: Connection is closed after HTTP response.
2018-06-05T09:44:29.247Z - info: sync: HTTP Connection[146]: Connection from 127.0.0.1:52491
2018-06-05T09:44:29.248Z - info: sync: HTTP Connection[146]: Connection is closed after HTTP response.

#6

@Alkhamisah Those docs are old and do not work anymore - please follow these:
https://docs.realm.io/platform/self-hosted/installation


#7

I see.
It was working fine for me except connecting to Realm Browser or Realm Studio on Mac.
Thanks for the support.