Uncaught (in promise) Error: XMLHttpRequest failed:

Did you try passing the variables instead of hardcoding them. As such -

 <MoralisProvider
        appId={appId}
        serverUrl={serverUrl}
        environment={environment}>
        <MoralisDappProvider>
          <ApplicationProvider {...eva} theme={eva.light}>
            {children}
          </ApplicationProvider>
        </MoralisDappProvider>
      </MoralisProvider>

If yes, there might be other issues in dependency installation. It will require some digging to understand what went wrong. I ran the boilerplate from my behalf and it happens to be working.

sir i also did that, i still get the same exact error, i even deleted the server and create a new one , still same error

import React from 'react';
import {MoralisProvider} from 'react-moralis';
import Moralis from 'moralis/react-native.js';
import AsyncStorage from '@react-native-async-storage/async-storage';
import {enableViaWalletConnect} from './Moralis/enableViaWalletConnect';
import WalletConnectProvider, {
  WalletConnectProviderProps,
} from './WalletConnect';
import {Platform} from 'react-native';
import Qrcode from "./Qrcode";
//import { expo } from "../app.json";
import {MoralisDappProvider} from './providers/MoralisDappProvider/MoralisDappProvider';
import {ApplicationProvider, Layout, Text} from '@ui-kitten/components';
import * as eva from '@eva-design/eva';
import {
  REACT_APP_MORALIS_APPLICATION_ID,
  REACT_APP_MORALIS_SERVER_URL,
} from '@env';

interface ProvidersProps {
  readonly children: JSX.Element;
}

/**
 * Initialization of Moralis
 */
const appId = REACT_APP_MORALIS_APPLICATION_ID;
const serverUrl = REACT_APP_MORALIS_SERVER_URL;
const environment = 'native';
// Initialize Moralis with AsyncStorage to support react-native storage
Moralis.setAsyncStorage(AsyncStorage);
// Replace the enable function to use the react-native WalletConnect
// @ts-ignore
Moralis.enable = enableViaWalletConnect;
// console.log(AsyncStorage.getAllKeys(), 'KEYS');

const walletConnectOptions: WalletConnectProviderProps = {
  storageOptions: {
    // @ts-ignore
    asyncStorage: AsyncStorage,
  },
  qrcodeModalOptions: {
    mobileLinks: [
      'rainbow',
      'metamask',
      'argent',
      'trust',
      'imtoken',
      'pillar',
    ],
  },
  // Uncomment to show a QR-code to connect a wallet
  renderQrcodeModal: Qrcode,
};

 const Providers = ({children}: ProvidersProps) => {
  return ( 
    <WalletConnectProvider {...walletConnectOptions}> 
      <MoralisProvider
        appId={appId}
        serverUrl={serverUrl}
        environment={environment}>
        <MoralisDappProvider>
          <ApplicationProvider {...eva} theme={eva.light}>
            {children}
          </ApplicationProvider>
        </MoralisDappProvider>
      </MoralisProvider>
    </WalletConnectProvider>
  );
};

export default Providers;
the error i got is this 

errors.js:39 
        
       Uncaught (in promise) Error: Provider not set or invalid
    at Object.InvalidProvider (errors.js:39:1)
    at RequestManager../node_modules/web3-core-requestmanager/lib/index.js.RequestManager.send (index.js:147:1)
    at sendRequest (index.js:623:1)
    at Eth.send [as getBlock] (index.js:655:1)
    at ENS../node_modules/moralis/node_modules/web3-eth-ens/lib/ENS.js.ENS.checkNetwork (ENS.js:468:1)
    at new Registry (Registry.js:38:1)
    at ENS.get [as registry] (ENS.js:41:1)
    at ENS.get [as resolverMethodHandler] (ENS.js:47:1)
    at JSON.stringify (<anonymous>)
    at Object.parseData (<anonymous>:8:116)
    at <anonymous>:10:2186
    at Array.reduce (<anonymous>)
    at <anonymous>:10:2114
    at i (<anonymous>:10:2685)
    at <anonymous>:10:2972
    at _ (<anonymous>:10:3098)
    at <anonymous>:10:3342
    at <anonymous>:347:34
    at Array.map (<anonymous>)
    at Object.emit (<anonymous>:347:24)
    at attachRenderer (react_devtools_backend.js:15640:12)
    at react_devtools_backend.js:15652:5
    at Map.forEach (<anonymous>)
    at initBackend (react_devtools_backend.js:15651:18)
    at setup (react_devtools_backend.js:12561:3)
    at welcome (react_devtools_backend.js:12507:3)
InvalidProvider @ errors.js:39
./node_modules/web3-core-requestmanager/lib/index.js.RequestManager.send @ index.js:147
sendRequest @ index.js:623
send @ index.js:655
./node_modules/moralis/node_modules/web3-eth-ens/lib/ENS.js.ENS.checkNetwork @ ENS.js:468
Registry @ Registry.js:38
get @ ENS.js:41
get @ ENS.js:47
parseData @ VM67:8
(anonymous) @ VM67:10
(anonymous) @ VM67:10
i @ VM67:10
(anonymous) @ VM67:10
_ @ VM67:10
(anonymous) @ VM67:10
(anonymous) @ VM58:347
emit @ VM58:347
attachRenderer @ react_devtools_backend.js:15640
(anonymous) @ react_devtools_backend.js:15652
initBackend @ react_devtools_backend.js:15651
setup @ react_devtools_backend.js:12561
welcome @ react_devtools_backend.js:12507
Promise.then (async)
Registry @ Registry.js:38
get @ ENS.js:41
get @ ENS.js:47
parseData @ VM67:8
(anonymous) @ VM67:10
(anonymous) @ VM67:10
i @ VM67:10
(anonymous) @ VM67:10
_ @ VM67:10
(anonymous) @ VM67:10
(anonymous) @ VM58:347
emit @ VM58:347
attachRenderer @ react_devtools_backend.js:15640
(anonymous) @ react_devtools_backend.js:15652
initBackend @ react_devtools_backend.js:15651
setup @ react_devtools_backend.js:12561
welcome @ react_devtools_backend.js:12507
postMessage (async)
sayHelloToBackend @ contentScript.js:100
(anonymous) @ contentScript.js:148
setInterval (async)
115 @ contentScript.js:144
__webpack_require__ @ contentScript.js:20
(anonymous) @ contentScript.js:84
(anonymous) @ contentScript.js:87
RESTController.js:302 
        
      
        
        
      
        
      
       
        
       POST https://jil5yvvpm3pd.usemoralis.com:2053/server/functions/getPluginSpecs net::ERR_NAME_NOT_RESOLVED
dispatch @ RESTController.js:302
setTimeout (async)
xhr.onreadystatechange @ RESTController.js:221
XMLHttpRequest.send (async)
dispatch @ RESTController.js:302
setTimeout (async)
xhr.onreadystatechange @ RESTController.js:221
XMLHttpRequest.send (async)
dispatch @ RESTController.js:302
setTimeout (async)
xhr.onreadystatechange @ RESTController.js:221
XMLHttpRequest.send (async)
dispatch @ RESTController.js:302
ajax @ RESTController.js:309
(anonymous) @ RESTController.js:416
Promise.then (async)
request @ RESTController.js:410
run @ Cloud.js:172
run @ Cloud.js:98
(anonymous) @ MoralisWeb3.js:652
tryCatch @ runtime.js:63
invoke @ runtime.js:294
(anonymous) @ runtime.js:119
asyncGeneratorStep @ asyncToGenerator.js:5
_next @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:34
Wrapper @ export.js:18
(anonymous) @ asyncToGenerator.js:23
(anonymous) @ MoralisWeb3.js:746
(anonymous) @ Parse.js:223
tryCatch @ runtime.js:63
invoke @ runtime.js:294
(anonymous) @ runtime.js:119
asyncGeneratorStep @ asyncToGenerator.js:5
_next @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:34
Wrapper @ export.js:18
(anonymous) @ asyncToGenerator.js:23
(anonymous) @ Parse.js:238
(anonymous) @ index.esm.js:3902
step @ index.esm.js:91
(anonymous) @ index.esm.js:72
(anonymous) @ index.esm.js:65
__awaiter @ index.esm.js:61
(anonymous) @ index.esm.js:3888
(anonymous) @ index.esm.js:3922
invokePassiveEffectCreate @ react-dom.development.js:23487
callCallback @ react-dom.development.js:3945
invokeGuardedCallbackDev @ react-dom.development.js:3994
invokeGuardedCallback @ react-dom.development.js:4056
flushPassiveEffectsImpl @ react-dom.development.js:23574
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
flushPassiveEffects @ react-dom.development.js:23447
performSyncWorkOnRoot @ react-dom.development.js:22269
(anonymous) @ react-dom.development.js:11327
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
flushSyncCallbackQueueImpl @ react-dom.development.js:11322
flushSyncCallbackQueue @ react-dom.development.js:11309
scheduleUpdateOnFiber @ react-dom.development.js:21893
enqueueForceUpdate @ react-dom.development.js:12504
./node_modules/react/cjs/react.development.js.Component.forceUpdate @ react.development.js:384
AnimatedComponent._this._animatedPropsCallback @ createAnimatedComponent.js:103
update @ AnimatedProps.js:116
(anonymous) @ AnimatedValue.js:62
_flush @ AnimatedValue.js:61
_updateValue @ AnimatedValue.js:287
(anonymous) @ AnimatedValue.js:247
onUpdate @ TimingAnimation.js:125
requestAnimationFrame (async)
start @ TimingAnimation.js:96
start @ TimingAnimation.js:104
animate @ AnimatedValue.js:244
start @ AnimatedImplementation.js:147
start @ AnimatedImplementation.js:153
(anonymous) @ Card.tsx:200
componentDidMount @ Card.tsx:108
commitLifeCycles @ react-dom.development.js:20663
commitLayoutEffects @ react-dom.development.js:23426
callCallback @ react-dom.development.js:3945
invokeGuardedCallbackDev @ react-dom.development.js:3994
invokeGuardedCallback @ react-dom.development.js:4056
commitRootImpl @ react-dom.development.js:23151
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
commitRoot @ react-dom.development.js:22990
performSyncWorkOnRoot @ react-dom.development.js:22329
scheduleUpdateOnFiber @ react-dom.development.js:21881
updateContainer @ react-dom.development.js:25482
(anonymous) @ react-dom.development.js:26021
unbatchedUpdates @ react-dom.development.js:22431
legacyRenderSubtreeIntoContainer @ react-dom.development.js:26020
render @ react-dom.development.js:26103
renderApplication @ renderApplication.js:23
run @ index.js:49
runApplication @ index.js:93
registerRootComponent @ registerRootComponent.tsx:14
(anonymous) @ index.js?41f5:36
./index.js @ index.js?41f5:36
__webpack_require__ @ bootstrap:789
fn @ bootstrap:100
0 @ immutable.js:19
__webpack_require__ @ bootstrap:789
(anonymous) @ bootstrap:856
(anonymous) @ bootstrap:856
Show 68 more frames
RESTController.js:302 
        
      
        
        
      
        
      
       
        
       POST https://jil5yvvpm3pd.usemoralis.com:2053/server/functions/getPluginSpecs net::ERR_NAME_NOT_RESOLVED
dispatch @ RESTController.js:302
setTimeout (async)
xhr.onreadystatechange @ RESTController.js:221
XMLHttpRequest.send (async)
dispatch @ RESTController.js:302
setTimeout (async)
xhr.onreadystatechange @ RESTController.js:221
XMLHttpRequest.send (async)
dispatch @ RESTController.js:302
setTimeout (async)
xhr.onreadystatechange @ RESTController.js:221
XMLHttpRequest.send (async)
dispatch @ RESTController.js:302
setTimeout (async)
xhr.onreadystatechange @ RESTController.js:221
XMLHttpRequest.send (async)
dispatch @ RESTController.js:302
ajax @ RESTController.js:309
(anonymous) @ RESTController.js:416
Promise.then (async)
request @ RESTController.js:410
run @ Cloud.js:172
run @ Cloud.js:98
(anonymous) @ MoralisWeb3.js:652
tryCatch @ runtime.js:63
invoke @ runtime.js:294
(anonymous) @ runtime.js:119
asyncGeneratorStep @ asyncToGenerator.js:5
_next @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:34
Wrapper @ export.js:18
(anonymous) @ asyncToGenerator.js:23
(anonymous) @ MoralisWeb3.js:746
(anonymous) @ Parse.js:223
tryCatch @ runtime.js:63
invoke @ runtime.js:294
(anonymous) @ runtime.js:119
asyncGeneratorStep @ asyncToGenerator.js:5
_next @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:34
Wrapper @ export.js:18
(anonymous) @ asyncToGenerator.js:23
(anonymous) @ Parse.js:238
(anonymous) @ index.esm.js:3902
step @ index.esm.js:91
(anonymous) @ index.esm.js:72
(anonymous) @ index.esm.js:65
__awaiter @ index.esm.js:61
(anonymous) @ index.esm.js:3888
(anonymous) @ index.esm.js:3922
invokePassiveEffectCreate @ react-dom.development.js:23487
callCallback @ react-dom.development.js:3945
invokeGuardedCallbackDev @ react-dom.development.js:3994
invokeGuardedCallback @ react-dom.development.js:4056
flushPassiveEffectsImpl @ react-dom.development.js:23574
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
flushPassiveEffects @ react-dom.development.js:23447
performSyncWorkOnRoot @ react-dom.development.js:22269
(anonymous) @ react-dom.development.js:11327
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
flushSyncCallbackQueueImpl @ react-dom.development.js:11322
flushSyncCallbackQueue @ react-dom.development.js:11309
scheduleUpdateOnFiber @ react-dom.development.js:21893
enqueueForceUpdate @ react-dom.development.js:12504
./node_modules/react/cjs/react.development.js.Component.forceUpdate @ react.development.js:384
AnimatedComponent._this._animatedPropsCallback @ createAnimatedComponent.js:103
update @ AnimatedProps.js:116
(anonymous) @ AnimatedValue.js:62
_flush @ AnimatedValue.js:61
_updateValue @ AnimatedValue.js:287
(anonymous) @ AnimatedValue.js:247
onUpdate @ TimingAnimation.js:125
requestAnimationFrame (async)
start @ TimingAnimation.js:96
start @ TimingAnimation.js:104
animate @ AnimatedValue.js:244
start @ AnimatedImplementation.js:147
start @ AnimatedImplementation.js:153
(anonymous) @ Card.tsx:200
componentDidMount @ Card.tsx:108
commitLifeCycles @ react-dom.development.js:20663
commitLayoutEffects @ react-dom.development.js:23426
callCallback @ react-dom.development.js:3945
invokeGuardedCallbackDev @ react-dom.development.js:3994
invokeGuardedCallback @ react-dom.development.js:4056
commitRootImpl @ react-dom.development.js:23151
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
commitRoot @ react-dom.development.js:22990
performSyncWorkOnRoot @ react-dom.development.js:22329
scheduleUpdateOnFiber @ react-dom.development.js:21881
updateContainer @ react-dom.development.js:25482
(anonymous) @ react-dom.development.js:26021
unbatchedUpdates @ react-dom.development.js:22431
legacyRenderSubtreeIntoContainer @ react-dom.development.js:26020
render @ react-dom.development.js:26103
renderApplication @ renderApplication.js:23
run @ index.js:49
runApplication @ index.js:93
registerRootComponent @ registerRootComponent.tsx:14
(anonymous) @ index.js?41f5:36
./index.js @ index.js?41f5:36
__webpack_require__ @ bootstrap:789
fn @ bootstrap:100
0 @ immutable.js:19
__webpack_require__ @ bootstrap:789
(anonymous) @ bootstrap:856
(anonymous) @ bootstrap:856
Show 70 more frames
construct.js:25 
        
       Uncaught (in promise) Error: XMLHttpRequest failed: "Unable to connect to the Parse API"
    at handleError (RESTController.js:445:1)

And what command are you using to run the application?

The reason I’m asking these many questions is because react-native has hundreds of points of failures that we need to analyse to make sure things are working.

i am using yarn web to run the app

Don’t try yarn web.

Please follow the steps in readme.

is it a sin to use yarn web?, i want my app to work in all ways

We don’t have expo integrated with react-native. Thus, it will only work in native environments like your simulator/ real life devices.

It’s not a sin to use anything. But the way the project is structured and architected, it does make it easier for you to follow the instructions that made it work in the first place.

yes it is been working in simulator, i just want it to work same way in the web, please do you know how to unable cors
i believe that will make it work in some way

The wallet connect functionality had breaking changes when we tried running on web through expo. Their official forum also had these issues mentioned. So, I’m afraid I do not know how to make it work on the web. :confused:

sir there is something wrong which i do not know about, because even in my web3-social-network boilerplate, i am still getting the same exact error

←→1 of 4 errors on the page
Unhandled Rejection (Error): Provider not set or invalid
▶ 26 stack frames were collapsed.
(anonymous function)
C:/Users/HP/src/hooks/_useResolveAsyncCall/_useResolveAsyncCall.ts:66
  63 | try {
  64 |   const results = await call(combinedParams);
  65 | 
> 66 |   setData(results);
     | ^  67 |   if (onSuccess) {
  68 |     onSuccess(results);
  69 |   }
View compiled
▶ 3 stack frames were collapsed.
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error.  Click the 'X' or hit ESC to dismiss this message.
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import { MoralisProvider } from "react-moralis";
import "./index.css";
import { MoralisDappProvider } from "./providers/MoralisDappProvider/MoralisDappProvider";

/** Get your free Moralis Account https://moralis.io/ */

const APP_ID = process.env.REACT_APP_MORALIS_APPLICATION_ID;
const SERVER_URL = process.env.REACT_APP_MORALIS_SERVER_URL;

const Application = () => {
  const isServerInfo = APP_ID && SERVER_URL ? true : false;
  if (isServerInfo)
    return (
      <MoralisProvider appId={APP_ID} serverUrl={SERVER_URL}>
        <MoralisDappProvider>
          <App isServerInfo />
        </MoralisDappProvider>
      </MoralisProvider>
    );
};

ReactDOM.render(
  // <React.StrictMode>
  <Application />,
  // </React.StrictMode>,
  document.getElementById("root")
);

REACT_APP_MORALIS_APPLICATION_ID =4iIHci6fwlwJ6cfphuObaEcdKCgFPkw7feYagGz7
REACT_APP_MORALIS_SERVER_URL = https://fagrndp36ogz.usemoralis.com:2053/server

sir, why am i always getting this provider not set error in all the boilerplate, is it from my end or what… this error is disturbing my brain

1 Like

Ah man, I’ve been trying to replicate this issue.

Just a quick rundown questions to evaluate -

  1. Which browser are you using? Does your browser have metamask extension installed?
  2. I’m assuming you did not make any changes to the code other than your .env file. Correct me if I’m wrong.
  3. Your server is up and running ? I’m assuming yes.
  4. Did you install all the dependencies again? By running yarn install?
my browser is Microsoft Edge and i have metamask install
my server is runner and i have all the dependencies installed by using yarn install

i did not change anything rather than inserting my server and app ID in the .env file
thank you sir, i just  switch my browser to chrome 
and it worked, even yarn web work without any provider error

Yes. That’s great ! Happy to help ! :slight_smile:

1 Like