realm / realm-js

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

Debugging with IntelliJ/WebStorm #617

Open jasonfma opened 8 years ago

jasonfma commented 8 years ago

This is super early lead. WebStorm is starting to support React Native debugging (https://blog.jetbrains.com/webstorm/2016/10/webstorm-2016-3-eap-163-6512/) and I tried it out and ran into what looks to be the same constructor issue as we saw in VS Code debugging.

jasonfma commented 7 years ago

IntelliJ is now public with react native debugging support. https://www.jetbrains.com/idea/whatsnew/#v2016-3-react-native

jasonfma commented 7 years ago

Linking the VS Debugging issue https://github.com/realm/realm-js/issues/583

jasonfma commented 7 years ago

Latest error against 1.0.2

screen shot 2017-02-07 at 11 17 23 pm
michalpetrov commented 7 years ago

Is there any workaround for this issue? It kind of sucks that I cannot debug my application because of realm.

jasonfma commented 7 years ago

I've been using the default chrome/web browser debugger.

jbreuer95 commented 7 years ago

+1

rovangju commented 7 years ago

I wasted several hours on this :( - browser debugger is you only choice. realm/lib/index.js - Line 26 (getContext()) appears to have some custom logic for detecting if it's using Chrome or not. It appears IntelliJ isn't sending a userAgent to pick up on either.

rovangju commented 7 years ago

2017-06-26 01_25_12-rn0 - h__code_rn0 - _node_modules_realm_lib_index js - intellij idea 2017 1 Here's a debug dump - breakpoint at https://github.com/realm/realm-js/blob/v1.8.1/lib/index.js#L29

I'm not sure why process + '' === '[object process]' is in there, but if I remove that and toss this inside the function, my IntelliJ Debugger for RN works just fine:

        if ('env' in process && 'NODE_ENV' in process.env) {
            return 'chromedebugger';
        }
kneth commented 6 years ago

See also #1530.