question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Importing Realm returns the error "Undefined is not a constructor (evaluating 'new XMLHttpRequest')"

See original GitHub issue

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

  • Realm JS SDK Version: 2.4.1
  • Node or React Native: RN v0.46.2
  • Client OS & Version: Mac OSX 10.13.4
  • Which debugger for React Native: Xcode v9.3

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:31 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
barbatuscommented, Apr 12, 2019

seeing this issue as well w/ RN 0.59

3reactions
Michaelvilleneuvecommented, Sep 11, 2018

By the way, something similar happens on Android. This message is iOS only but here is the error for both platforms :

  • ios crash :

undefined is not a constructor (evaluating 'new XMLHttpRequest()') makeRequest - rpc.js:204:22

  • android crash :

Can't find variable : Symbol <unknown> - constants.js:30:24

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: undefined is not a constructor (evaluating 'new ...
I am trying to add firebase auth to my mobile application using this link to support phone number authentication. A minimal version of...
Read more >
undefined is not a constructor evaluating new XMLHttpRequest
Hi, for a project with Dynamics 365 Online version 8.2, I wrote a JS script which runs on the Order Entity, performs a...
Read more >
receiving [TypeError: undefined is not an object (evaluating ...
Have been trying to use starter code from the RN tutorial and have not successfully pushed a new document to local Realm DB...
Read more >
TypeError: undefined is not a constructor react-native
Answers: “undefined is not a constructor” is an error message PhantomJS displays when you try to call a function that is not defined....
Read more >
Safari Technology Preview Release Notes - Apple Developer
currentSrc to not get reset when a new load error occurs (251654@main) ... in import rules can not be reordered on media query...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found