Realm-js: Realm.login() will not run again after refreshing React Native app

Created on 18 Sep 2020  ·  3Comments  ·  Source: realm/realm-js

Goals

Be able to successfully call Realm.login() again after refreshing app.

Expected Results

Login should run and return the user information like the first time the app loads

Actual Results

Nothing happens, no errors shown in the console. Realm logs don't show the request is being made.

When I fire up the React Native Debugger, I did see an error about Realm.Credentials.function(payload); not being able to be created. I believe some of the functionality for function auth is missing in the lib/browser/credentials.js and lib/browser/rpc.js. We are using function auth, however, I received the same behavior of the original issue using anonymous and other auth types.

Steps to Reproduce

Launch app from Xcode in simulator or on iOS device.
Run Login (works beautifully).
Refresh the react native bundle from the package server.
Try to login again (nothing happens)

Version of Realm and Tooling

  • Realm JS SDK Version: 10.0.0-beta.12
  • Node or React Native: React Native 0.62.2
  • Client OS & Version: iOS
  • Which debugger for React Native: Chrome
O-Community

Most helpful comment

All 3 comments

I have the same issue.
I have to kill the app and relogin

➤ Chris Bush commented:

Encountered this myself. Some investigation revealed that (on iOS at least) the RunLoopScheduler is stale because its m_runloop is still pointing to the original thread, whereas the JS executor is actually running on a different thread after an app reload. This causes the scheduler to never be able to schedule requests, so the requests to log in are never heard from again. Please DM me for more details.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timanglade picture timanglade  ·  3Comments

Chris-Petty picture Chris-Petty  ·  3Comments

max-zu picture max-zu  ·  3Comments

MihaelIsaev picture MihaelIsaev  ·  3Comments

kevinnguy picture kevinnguy  ·  3Comments