realm-js: Realm.open() hangs on Android

EDIT: This also happens after reloading the emulator on React Native, in a very simple setup (see below https://github.com/realm/realm-js/issues/1248#issuecomment-328313637)

Goals

Get an error message when opening a synced realm if server not available or user is offline.

Expected Results

Realm.open() returns a promise that gets rejected with useful error message.

Actual Results

The promise simply stays in pending status indefinitely.

This callback does not get called:

https://github.com/realm/realm-js/blob/416632c9adc7350cdca12dc792edcf3e9d0b30d8/lib/extensions.js#L47

Hence the promise never returns.

Steps to Reproduce

Run this code after log in with valid user:

const openRealm = (user, url, schema) => {
  return Realm.open({
    sync: { user, url },
    schema,
    schemaVersion: 1
  });
};

Version of Realm and Tooling

  • Realm JS SDK Version: 1.10.3
  • React Native: 0.44.3
  • Which debugger for React Native: None

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 25 (10 by maintainers)

Most upvoted comments

I’m able to reproduce this as well, on android the first app load works, but reloading JS code makes realm.open never resolve.

I’m able to reproduce the issue and indeed the callback to _waitForDownload never gets called.