Realm-js: [Bug]: realmConstructor.Sync._initializeSyncManager is not a function

Created on 23 Nov 2018  路  17Comments  路  Source: realm/realm-js

Goals

Resolve realmConstructor.Sync._initializeSyncManager is not a function error that occurs while trying to use React Native debugger

Expected Results

A user should be able to debug React Native App using React Native debugger tools (Chrome based).

Actual Results

Error:

realmConstructor.Sync._initializeSyncManager is not a function
handleException @ ExceptionsManager.js:76
handleError @ InitializeCore.js:69
reportFatalError @ error-guard.js:42
guardedLoadModule @ require.js:209
metroRequire @ require.js:136
(anonymous) @ bundle.umd.js:1
executeApplicationScript @ RNDebuggerWorker.js:1
t @ RNDebuggerWorker.js:1

Steps to Reproduce

react-native init AwesomeApp
yarn add realm
react-native link realm
react-native run-ios

Code Sample

I used an example from your documentation

import Realm from 'realm';

const CarSchema = {
  name: 'Car',
  properties: {
    make: 'string',
    model: 'string',
    miles: { type: 'int', default: 0 },
  },
};

const realm = new Realm({ schema: [CarSchema] });

export const queryCars = () => {
  return realm.objects('Car');
};

export const addCar = () => {
  realm.write(() => {
    const myCar = realm.create('Car', {
      make: 'Honda',
      model: 'Civic',
      miles: 1000,
    });
    myCar.miles += 20; // Update a property value
  });
};

export default realm;

Version of Realm and Tooling

  • Realm JS SDK Version: 2.20.0
  • Node or React Native: React Native - 0.57.5
  • Client OS & Version: MacOS - Mojave
  • Which debugger for React Native: React Native Debugger (Chrome based)

Temporary Solution:

Commeting out this line worked but this is not the best solution:
Path: node_modules/realm/lib/index.js
comment out this line:
realmConstructor.Sync._initializeSyncManager(createUserAgentDescription());

O-Community T-Bug-Crash

Most helpful comment

@kaoDev Hopefully today.

All 17 comments

same 馃憤 , when enable Remote debugging

Bump. Any solutions?

same happen to me, when enable Remote debugging
:Realm JS SDK Version: 2.20.0

i have this bug too

When will this be released to npm? #2130 got merged a few days back and the current version 2.20.0 is unusable for development without modification of the code in "node_modules"

@kaoDev Hopefully today.

I updated to 2.20.1 and it still appears. @bmunkholm

still appears in 2.20.21 @bmunkholm

That's weird. We will have to look at that again then. @cmelchior

Still have this issue on 2.20.1. @bmunkholm

packages.js

"dependencies": {
"randomcolor": "^0.5.3",
"react": "15.x",
"react-native": "^0.57.4",
"react-native-fs": "^2.12.1",
"react-native-sound": "^0.10.9",
"react-native-svg": "^8.0.8",
"react-orchestra": "^0.5.2",
"realm": "^2.20.1"
},
"devDependencies": {
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.49.2",
"react-test-renderer": "16.6.1"
},

+1 Having the same issue ...

how can I get this solved issue in my application??

Are the merge already available via npm o yarn ?
I tried :
rm -rf node_modules
yarn install

And the problem was still here.
I checked the changed files according to the Merged :
https://github.com/realm/realm-js/commit/5c0171058764e5f98b6ba92ce586ddcda4b0d1e8

My version of realm did had those changes.

What did I do wrong ?

The changes will be released with a future version of realm-js. If you are encountering this problem, there's a proposed solution in the first post.

I'm on 2.21.0 now, but still getting the same issue... :-( @nirinchev, that version is released one day after your message.

realmConstructor.Sync._initializeSyncManager

This problem is still unresolved ?
So how do we debug the project?

I am still facing the debug issue. The application won't run with chrome dev tools or react-native debugger.
React-Native version - 0.59.5
React version - 16.8.3
Realm version 2.26.1
Can someone tell me how to fix this.

Was this page helpful?
0 / 5 - 0 ratings