Realm-js: Require cycle on React Native

Created on 24 Jun 2019  路  4Comments  路  Source: realm/realm-js

Goals

I'm trying to use Realm with react native, it works fine until I turn on Debug JS Remotely in my react native app.

Expected Results

Work as expected.

Actual Results

Console error and app fails to launch

Require cycle: node_modules/realm/lib/browser/util.js -> node_modules/realm/lib/browser/rpc.js -> node_modules/realm/lib/browser/util.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.

Steps to Reproduce

  • Simply initializing the react native app suffices

Code Sample

const PaymentMethodsSchema = {
    name: 'PaymentMethods',
    primaryKey: 'payment_method_id',
    properties: {
        payment_method_id: 'int',
        type: 'string',
        last4digits: 'string',
    }
};

Realm.open({ schema: [PaymentMethodsSchema] })

Version of Realm and Tooling

  • Realm JS SDK Version: 3.0.0-beta.1
  • Node or React Native: 0.59.5
  • Client OS & Version: Mac OS Mojave
  • Which debugger for React Native: React Native default debugger
O-Community T-Duplicate

All 4 comments

Similar issue #2409

Hey - looks like you forgot to add a T:* label - could you please add one?

For anybody facing this issue, this was how I solve the problem.

  1. Install this version: ^2.28.1
  2. Unlink realm: react-native unlink realm
  3. Link realm again: react-native link realm

Problem solved

Was this page helpful?
0 / 5 - 0 ratings