-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Importing Realm returns the error "Undefined is not a constructor (evaluating 'new XMLHttpRequest')" #1788
Comments
Maybe I misinterpret:
but you can only debug React Native apps using Chrome. |
I fixed this by downgrading Realm. In package.json, the line for realm is now: instead of: |
There has to be a better solution than downgrading to @kneth what he means is the error only springs when you're debugging. This is a pretty killer issue. Is it worth downgrading so much to solve it? EDIT: Downgrading did not solve this issue for me. Request to reopen this ticket |
#1732 is a similar issue with some suggestion on how to solve it. |
@arshbot were you able to overcome this issue? |
It works when I am remote debugging (:8081). It does not work when not remote debugging. |
@woodpav what about the production build? |
The production build would crash immediately. start_wqthread or something like that. Also if I let the debug build sit there it would crash after a few minutes due to a Realm error "attach notification listener". So I had 3 crashes including the one initially mentioned. I was using a fresh install of Realm from npm and the only Realm code I had was |
@sheva007 there is a way around this, and it is frustrating. I can't remember what I did but it was definitely a mix of uninstalling, reininstalling, relinking, resetting, etc until something clicked correctly and realm stopped fucking itself. This really should be reopened @kneth |
Seing this too, should be reopened |
@Michaelvilleneuve @sheva007 @arshbot Any suggestions on how to reproduce this? |
Honestly I have no idea. It just started happening and since then I can’t remove that error unless I activate chrome remote debugging |
Thanks @bmunkholm for the re-open, I have tested realm with typescript in a fresh project and all was smooth, But when tried with the current existing project I get this error. in Android I get "can't find variable Symbol"; while in ios "Undefined is not a constructor (evaluating 'new XMLHttpRequest')" Apart from realm, here are my dependencies: |
@sheva007 I share these packages with you : "dependencies": {
"react": "16.4.1",
"react-native": "0.55.3",
"react-native-vector-icons": "^5.0.0",
"react-navigation": "2.7.0",
"realm": "2.8.0",
},
"devDependencies": {
"eslint": "4.19.1",
}, I'm not sure why there would be a relation to them but still. One thing I might have done before breaking realm is linking |
By the way, something similar happens on Android. This message is iOS only but here is the error for both platforms :
|
same issue. Downgrading realm works for me, and I found the problem happened after version 2.0.2: |
So I've taken another swing at it and I've gotten further than before. I'll try to recount exactly what I've done but it was a lot of back and forth so my details may not be perfect. I installed Realm v2.17.0 and I was getting the same errors @Michaelvilleneuve mentioned until I upgraded my project to RN 0.56 and React to 16.4.1. Then I started getting errors about debugHosts and remote debugging. I tried @JamesZhange advice and it works when I use Realm v2.0.2. I had to follow the manual steps for linking Android as well. So far it seems to be working. The only side effect I seem to have now is that chrome debugging is not working on Android simulator (The device screen is all white and the debugger window just loads infinitely). |
I have the same issue too, any updates? (React native 0.54.5, Realm v2.17.0, Android) |
I still have the same error, did anyone solve it? |
also facing this error, does anybody have any solutions? |
We have just released v2.25.0. Please try to upgrade. |
error is not gone after realm upgrade. |
@v0lume Just to be clear: you only see an issue when you upgrade? |
@kneth no, it was before upgrade also. seems something was wrong in my project, when i init new CRNA application, add realm - i don't see any errors |
what happened to me is this error occurs while I stop debug js remotely, and if i enable remote debug, works fine. |
seeing this issue as well w/ RN 0.59 |
Is someone able to make a clear self contained repro-case available in github? |
I close the issue, and we can reopen once it can be reproduced easily. |
it's very weird, everything works fine yesterday, but when I open my app and turn on'Debug JS Remotely' today, this error pops up…… I do not change any code, it just happens. but if I turn off 'Debug JS Remotely', this error will disappear. ps. it only happened on real device with Chrome Developer Tools, so I have to use simulator, or use real device with Safari Developer Tools update: platform: iOS |
Wow. Yes. Super strange. |
Goals
Import Realm into a React Native project.
Expected Results
I should be able to import Realm and run the project in iOS with crashing.
Actual Results
The app crashes in release mode completely. The app crashes in debug mode if not using Chrome Debugger and I get this error on the screen:
Undefined is not a constructor (evaluating 'new XMLHttpRequest')
I get this repeating error in the console
"Must first create RPC session with a valid host".
Steps to Reproduce
I'm trying to import Realm into my React Native project and run in iOS. I've installed the npm and linked it. It crashes when I add the following line:
import Realm from 'realm';
Version of Realm and Tooling
The text was updated successfully, but these errors were encountered: