Realm-js: constructor must be of type 'function' on debugger mode

Created on 6 Oct 2018  路  32Comments  路  Source: realm/realm-js

Goals

It is working as well without debugger mode. But on debugger mode, we are getting error when try to create Realm object with schema parameters.

Expected Results

It should work like without debugger

Actual Results

image

image

Code Sample

image

Version of Realm and Tooling

  • Realm JS SDK Version: 2.17.0
  • React Native: 0.57.1
  • Client OS: Android
  • Which debugger for React Native: Chrome
O-Community T-Bug

Most helpful comment

It is related from last version of realm(v2.18.0). You should downgrade to 2.16.0.
And dont forgot to check version number on package.json. It should be "realm": "2.16.0" not "realm": "藛2.16.0". I lost 1 day for that :triumph:

After that, run this code for reset all packages;
watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache

All 32 comments

I am still getting this error with realm v2.18.0

+1

I'm having the exact same issue as op

+1 . How to fix this. Previously its working fine. I updated my OS. started getting this error. Please help

### Version of Realm and Tooling
Realm JS SDK Version: 2.16.0
React Native: 0.57.0
Client OS: Android
Which debugger for React Native: Chrome

screenshot_20181011-175639

Version 2.16.0 its working fine on RN 0.57.2

@NaveenJayaram94 You upgraded from which OS to which OS?

Actually, I've downgraded to 2.16.0. I did it yesterday. I was suffering about last 2 weeks because of this. I'm working on two differents machines. Win and MacOS. (10 and High Sierra)

I downgraded from Ubuntu 18.10 to 17.10.
Yesterday in 18.10 its working fine, today downgraded my os, in first compile only its throwing this error. I don't know what to do

Happening to me too. I haven't updated my OS or realm version. Not sure this is related, but the error started popping up after I ran these commands:

rm -rf node_modules
npm cache clean
npm install

but its work well without debugging, but without chrome debugging its very difficult develop RN App. Searching for other mobile NoSql DB.

@NaveenJayaram94 Have you tried to use Safari on Mac? Others have great experience with that instead of Chrome.

@bmunkholm , I use Ubuntu 17.10. so only option left is the firefox browser. Tomorrow I'll test it and update here. thanks

+1111

@bmunkholm even in firefox same error. searching for alternatives with NoSQL and real time database.

Some fix for this?

It is related from last version of realm(v2.18.0). You should downgrade to 2.16.0.
And dont forgot to check version number on package.json. It should be "realm": "2.16.0" not "realm": "藛2.16.0". I lost 1 day for that :triumph:

After that, run this code for reset all packages;
watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache

@mistikk Thanks budy. You saved me from disaster
it worked after downgrading my node from 10.X.X to 9.8.0

+1 on react-native for 2.18.0

I have same issue in v2.18.0. Downgrade to v2.17.0 is solve.

Got it fixed by upgrading to 2.19.0-rc.4.

I've commented out the line 80 from "node_modules\realm\lib\browser\index.js".

[80] //config = this._constructor(config);
[81] let schemas = typeof config == 'object' && config.schema;
[82] let constructors = schemas ? {} : null;

It had a very slow start (when debug is on) but it worked fine for me on v2.19.0.

+1 for 2.19.0. Working ok on 2.17.0

still there on 2.19.1 :(

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

@achilles-kosun, it鈥檚 fixed in 2.20, but there is one more issue with debug mode , that already fixed on master branch

@alexmbp That's wonderful!

Get very similar error:
image

Version of Realm and Tooling

Realm JS SDK Version: 2.20.1
React Native: 0.57.7
Client OS: Android / iOS
Which debugger for React Native: React Native Debugger / Chrome

@radeno I've created a patch for myself

You can use it. It require patch-package installed and used. You will need to remove this .txt extension.

realm+2.20.0.patch.txt

@alexmbp your patch adding something is already available in 2.20.1 and as i have written what i use that version :) https://github.com/realm/realm-js/blob/cfb54f07fc7530530fc7d4e285d531d157489c33/lib/browser/index.js#L136
So there must be another issue.

@radeno Than it should work already. I've hardcoded version to 2.20.0

@alexmbp trust me, it doesn't.
Anyway my issue is connected with https://github.com/realm/realm-js/issues/2128 and will be fixed for real with this PR https://github.com/realm/realm-js/pull/2157

I tested with a completely new project using RealmJS 2.21.1 and debugging seems to work fine there. Closing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

blagoev picture blagoev  路  3Comments

bdebout picture bdebout  路  3Comments

texas697 picture texas697  路  3Comments

timanglade picture timanglade  路  3Comments

kevinnguy picture kevinnguy  路  3Comments