Realm-js: Unknown execution context on iOS Simulator with Remote JS Debugging

Created on 8 Feb 2017  路  22Comments  路  Source: realm/realm-js

  1. Goals
    Debug code with Remote JS Debugging.

  2. Expected results
    Debug code with Remote JS Debugging.

  3. Actual results
    Red error screen with title 'Unknown execution context'
    uec

  4. Steps to reproduce

  5. Create new project react-native init TestRealm
  6. Install Realm npm install --save realm or yarn add realm
  7. Link Realm react-native link realm
  8. In index.ios.js insert import Realm from 'realm
  9. Run code react-native run-ios
  10. Enable Remote JS Debugging

  11. Code sample that highlights the issue
    https://github.com/aparedes/TestRealm

  12. Version of Realm 1.0.2 / Xcode 8.2.1 / OSX 10.11.6

T-Bug

Most helpful comment

Do you have the debugger with device toolbar on?screen shot 2017-02-17 at 14 58 48

It seems that is the one causing the problems. Or at least for me.

All 22 comments

Hi @aparedes did you run react-native link realm? This should be noted in the error message, I need to fix that..

Yes, I did run react-native link realm.

I only get this error with the Remote JS Debugging activated, otherwise it works and I can write and read to/from the Realm database.

I see, in that case something else is wrong. Thank you for reporting.

I got this issue, too. Does it fix yet?

I tried to reproduce this problem, but its to be running fine on my computer, tried both iPhone SE and iPhone 6 simulators.

Looking at the getContext here here, it seems to only work when user agent is set to contain Chrome. What debugger are you using? (@aparedes & @anonymoushitec)

Realm 1.0.2, Xcode 8.2.1, OSX 10.12.3

I'm using Realm 1.0.2 / Xcode 8.2.1 / OSX 10.11.6 / React-Native 0.41.2 / Chrome 56

I can't reproduce it anymore, could be something with Xcode, that needed a restart or something.

I got this issue, too. if close the "Remote JS Debugging', it's works well.

    if (typeof Realm !== 'undefined') {
        if (typeof navigator !== 'undefined' &&
            navigator.product === 'ReactNative') { // eslint-disable-line no-undef
            return 'reactnative';
        }

        return 'jscore';
    }

when Remote JS Debugging is off, the fragment return 'reactnative'. if remote js debugging is on, return undefined, so throw Error("Unknown execution context");

I had the same, but tried again a few days later and it worked. I didn't change a thing.

Do you have the debugger with device toolbar on?screen shot 2017-02-17 at 14 58 48

It seems that is the one causing the problems. Or at least for me.

I have the same problem
what do you mean by the debugger with the (the picture you provided) on?
do we have different debuggers inside of Xcode?

I mean in Chrome Dev Tools

When you are in the phone or simulator, you enable the debugging and it opens chrome. In chrome, if you press the device toolbar on it shows the web view in a "mobile" view. That seemed to be causing some issues for me. When it was disabled, it was acting normal

I am having the same issue. It only happens when I am debugging with Nuclide debugger. Works fine with dubugging off and when dubugging routed through Chrome.

running react-native run-ios again, worked for me.

Also getting this error when trying to run on (iOS) device. Haven't changed anything, but after working on a different project and trying to run this one again it just started failing :(

I have the same problem with debugging off. Nothing works.
Tried the following:

  • restart server
  • react-native run-ios
  • restart comp (mac osx)
  • installing on fresh new react native project
  • react-native link realm

Btw, using node version 6.10 as recommended in realm docs.

@oliviachang29 I am sorry to hear that. If you are able to provide us with a repro-case in some form we can try taking a look at it.

Got it working after starting on a fresh new project. Not sure what specifically got it to work.

I am not running in debug mode. Still, I am getting the same
222
111

Why is this closed? It's still a problem.

I am also facing same problem even after running "react-native link realm"

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timanglade picture timanglade  路  3Comments

blagoev picture blagoev  路  3Comments

max-zu picture max-zu  路  3Comments

ashah888 picture ashah888  路  3Comments

emrehayirci picture emrehayirci  路  3Comments