-
Notifications
You must be signed in to change notification settings - Fork 36
"Realm is empty" when initiated through Android #251
Comments
This might just be as simple as the Realm hasn't completely downloaded. You can figure out when the Realm is downloaded by asynchronously opening the Realm: https://realm.io/docs/java/latest/#asynchronously-opening-realms Or you can attach a progress notification: https://realm.io/docs/java/latest/#sync-sessions Opening a Realm normally will give you immediate access (synchronously) but the data still must be synced down that already exists for that Realm which happens asynchronously. |
If there is still a problem, I would aske you to turn on debug level logging on both the Android client and server. Thanks. |
We tried the async solution that @bigfish24 had mentioned and got it up and running today, but it didn't help. The issue remains. We are going to try to run the logs tonight, but we have a beta build out to testers that we can't make absolute sure that they won't try to access the server. Hopefully we can still get enough information from the logs to help diagnose the problem. This wasn't (in my recollection) an issue before we upgraded to ROS 2 and then had to downgrade. I'm not sure which client version we were using before, but just to make sure, no one else is reporting this issue with Android connectivity issues with Realm 1.10.0 and ROS 1.8.3? Thanks. We'll post logs later tonight. |
@morten-krogh I have collected some logs from the Android app as well as the server. As @misterlib mentioned some of the logs may be from other users that are out of our control, but things looked pretty quiet before I started to collect the logs. The actions that I took were logging into an existing sync user and open a synced realm with that user. The login works correctly, but the data is never fetched. We are using Any help you could provide would be greatly appreciated. Thanks! |
I don't see any sync activity in the client-log.txt at all. Is this log captured while you The server did not receive any sync request from your client either. Basically, nothing important happened in these log files. Can you try again? What log level do you use on the client? Try to sync from iOS as well such that I can see the server log with the iOS connection as well. Thanks. |
@morten-krogh those logs were captured while I was attempting to sync. The data never comes through though. I have created new captures of the logs on both Android and iOS from the client and server. On the Android client I used the verbose log level and on iOS I used the default. Here's what happened. android-client-log.txt |
Yes, it seems clearly like the problem originates from the Android device. Are you sure that your code is correct on Android. Did the same code work before? Can you post the code? |
@morten-krogh Here is the code we call. We start off by calling the getRealmObjectServerURL() {
return `https://${env.realmHost}:${env.realmPort}`;
},
logUserIn({ username, password }, next) {
Realm.Sync.User.login(
realmManager.getRealmObjectServerURL(),
username,
password,
(error, user) => {
if (error) {
return typeof next === 'function' && next(error);
}
realmManager.initializeSyncedRealm(user, (error, realm) => {
return typeof next === 'function' && next(error, user, realm);
});
},
);
},
initializeSyncedRealm(user, next) {
realmManager.logInToSyncedRealmWithUser(user, next);
},
logInToSyncedRealmWithUser(user, next) {
Realm.openAsync(
{
sync: {
user,
url: `realms://${env.realmHost}:${env.realmPort}/~/placefordata`,
},
schema: realmManager.getSchema(), //return schema
},
(error, realm) => {
realms.synced = realm;
if (typeof next === 'function') {
next(error, realm);
}
},
);
}, Do you see anything wrong with this code? I assume not, because this code is working on iOS. But if you see any issues I would be happy to update things to see if we could get this fixed. Thanks! |
@jasonmerino can you turn on debug logs for Realm: https://realm.io/docs/java/latest/#logging This will help reveal what is wrong with the client. |
@bigfish24 it looks like there is no RealmLog class for the react native library. I've got the following import in the apps MainApplication.java
But I tried pasting that code in there and it says that it cannot resolve I also attempted to set the sync logging level on the JS side but it looks like |
For JS it should be |
@bigfish24 I just tried to get the logs again. I guess I was doing something wrong before because it didn't crash this time, but when I tried to get the logs again they look pretty similar as they did before. Here's the log. Just for the heck of it I had @misterlib set up a non encrypted realm and pointed the existing code to that one and I was able to log in just fine. So it seems there is some issue with the encrypted realm connection, but the logs don't seem to reflect any issues. I'm a little stumped. |
For reference, I did exactly what it says to do in: https://academy.realm.io/posts/securing-the-realm-object-server-with-lets-encrypt/ |
Let us check if there is a problem with the client rejecting the server's SSL certificate. Try to set validate_ssl: false in the sync object sync: { |
@morten-krogh setting Now, how do we find out if it's an issue with our cert, the Android SDK, or the iOS SDK? |
@jasonmerino Good to hear. We actually know about similar issues. It is not an issue with your own certificate. It is an issue in our system that has to do with the way our JS SDK is combined with openssl, I believe. I suggest that you set validate_ssl to false until we solve the issue. You are still using a SSL connection when validate_ssl = false. We will hopefully soon get to the bottom of this issue. |
@morten-krogh do you have an issue on Github that I can subscribe to where you guys are tracking progress on this? |
@jasonmerino I don't know if there is a public issue. We will keep this issue open. |
@morten-krogh that works for me. Thanks! |
I have the same problem on React Native, realm-js library. It works on iOS. On Android, My synced realm is read-only and not encrypted. Setting I'm using no special code for iOS vs. Android, yet it only works in iOS. This happens on emulator and device, both on localhost and webserver. |
@morten-krogh could you have look at my logs? On the client site, the Android log is silent: The call |
@Damnum I will look at it soon. |
Yes, the log for the Android client shows that the server receives nothing from the Android We will look into this. |
Our app is built in React Native, published on iOS and Android.
Everything is working as expected on iOS.
After migrating from a local realm to a synced realm and connecting to the ROS, a new user is created, but when trying to view the data in the Realm, it says "Realm is empty".
More potentially helpful information: while sync is working between devices on iOS, when connecting to that Realm from an Android device, the authentication works, but no data is actually transferred to the Android device from the server.
Goals
Connect to server and read/write to a realm on Android
Expected Results
After authentication, the data would begin flowing in both directions.
Actual Results
After authentication, nothing happens.
Steps to Reproduce
I'm not sure.
Code Sample
We could search for some code to provide, but it is working on iOS, so not sure it is something that needs to change in the code.
(Side note, we migrated to ROS2.0 last week and have rolled back and have begun encountering this issue as we have reworked the code to work on ROS1 again, which it is on iOS. This abnormality with Android was not happening before the upgrade and then subsequent downgrade)
Version of Realm and Tooling
Logs
systemctl status realm-object-server.service
Paste output here
sudo journalctl -u realm-object-server.service
Paste output here
cat /var/log/realm-object-server.log
Paste output here
The text was updated successfully, but these errors were encountered: