realm-js: Subscription not defined in react native - debug mode

Goals

Debugging react native application using realm 2.3.0. The bug is generating when importing realm. All works fine in non-debug mode. In 2.2.15 debug works ok.

simulator screen shot - iphone 6 - 2018-03-14 at 00 33 53

exports.default = Realm; util.createMethods(Realm.prototype, _constants.objectTypes.REALM, [‘addListener’, ‘removeListener’, ‘removeAllListeners’, ‘close’, ‘_waitForDownload’, ‘_objectForObjectId’]); util.createMethods(Realm.prototype, _constants.objectTypes.REALM, [‘delete’, ‘deleteModel’, ‘deleteAll’, ‘write’, ‘compact’, ‘beginTransaction’, ‘commitTransaction’, ‘cancelTransaction’], true); var Sync = { User: _user2.default, Session: _session2.default, Subscription: Subscription }; index.bundle?platform=ios&dev=true&minify=false:13121 Subscription is not defined

Actual Results

Steps to Reproduce

Code Sample

Version of Realm and Tooling

  • Realm JS SDK Version: 2.3.0
  • Node or React Native: 0.54.2
  • Client OS & Version: ios simulator
  • Which debugger for React Native: React native debugger

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 25
  • Comments: 38 (8 by maintainers)

Commits related to this issue

Most upvoted comments

I downgraded from 2.3.0 to 2.2.8 using npm: install realm@2.2.8 and after that run: react-native link it redownloaded the cocoa packages and it worked fine for me good luck 🥇

2.3.3 still not fixed, same issues. I really don’t understand how everyone(besides us here) using 2.3.3 can debug their realm application. How does the realm team debug their application in react native with 2.3.3

Looks like it might be failing because #1583 changed browser/index.js to add Subscription to the Sync const but there’s no import for Subscription? (link)

At least, that seems to be where it’s falling over in the debugger

I have unpublished 2.3.5 and released it as 2.4.0 (and sneaked the logout fix in).

Same issue here. Downgrading from realm@2.3.0 to realm@2.2.15 solves this problem.

Didnt worked for me, I even reset the simulator, reinstall modules, link aigan, etc. All worked fine with no debug mode. In debug mode the error appears again and if I comment import realm then debug mode works. For the moment I use 2.2.15 if i upgrade to 2.3.0 I will get the same error.

Just 1 min ago updated back to 2.3.0, uninstall the application from simulator, started again the builder etc, => Subscription is not defined

Same here, any Realm 2.3.+ produces this error. 2.2.18 works fine.

@Dexwell @jeprojects I mentioned this error in #1744 comment section, but I did not get answers about it. I was able to resolve by changing 'logout' to '_logout' here: https://github.com/realm/realm-js/blob/c3a83f1866542a148a52495a8e7f014c57c33c66/lib/browser/user.js#L45 Apparently this function is called here: https://github.com/realm/realm-js/blob/c3a83f1866542a148a52495a8e7f014c57c33c66/lib/user-methods.js#L387

@kneth I get the error “Cannot redefine property: logout”

I just tested and #1711 is fixed in 2.4.1