realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.62k stars 558 forks source link

constructor must be of type 'function' on debugger mode #2053

Closed mistikk closed 5 years ago

mistikk commented 5 years ago

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

mistikk commented 5 years ago

I am still getting this error with realm v2.18.0

ithustle commented 5 years ago

+1

Copterdoctor commented 5 years ago

I'm having the exact same issue as op

NJJ2 commented 5 years ago

+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

ithustle commented 5 years ago

Version 2.16.0 its working fine on RN 0.57.2

bmunkholm commented 5 years ago

@NaveenJayaram94 You upgraded from which OS to which OS?

ithustle commented 5 years ago

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)

NJJ2 commented 5 years ago

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

jgplane commented 5 years ago

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
NJJ2 commented 5 years ago

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

bmunkholm commented 5 years ago

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

NJJ2 commented 5 years ago

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

figure-ai commented 5 years ago

+1111

NJJ2 commented 5 years ago

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

wesleyguirra commented 5 years ago

Some fix for this?

mistikk commented 5 years ago

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

NJJ2 commented 5 years ago

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

JackHull commented 5 years ago

+1 on react-native for 2.18.0

sinhpn92 commented 5 years ago

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

JackHull commented 5 years ago

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

Jefferson-Henrique commented 5 years ago

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.

alexmbp commented 5 years ago

+1 for 2.19.0. Working ok on 2.17.0

achilles-kosun commented 5 years ago

still there on 2.19.1 :(

realm-probot[bot] commented 5 years ago

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

alexmbp commented 5 years ago

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

achilles-kosun commented 5 years ago

@alexmbp That's wonderful!

radeno commented 5 years ago

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

alexmbp commented 5 years ago

@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

radeno commented 5 years ago

@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.

alexmbp commented 5 years ago

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

radeno commented 5 years ago

@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

cmelchior commented 5 years ago

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