[SOLVED] "Unable to connect to the Parse API" on NodeJS

I’ve attempted to run Moralis on NodeJS but I keep getting this error:

ParseError: XMLHttpRequest failed: "Unable to connect to the Parse API"
    at handleError (C:\Users\38976\node_modules\moralis\lib\node\RESTController.js:436:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 100
}

What is your code? Usually this error means that you didn’t set Application ID and SERVER_URL.

const Moralis = require(‘moralis/node’);

Moralis.initialize(‘APPID’);

Moralis.serverURL = ‘ServerURL’;

Both are set but can’t get it to initialize. This APPID and ServerURL work on the web version but not on nodejs

This works fine for me:


x = async () => {
    const  Moralis = require('moralis/node')
    Moralis.initialize("APP_ID")
    Moralis.serverURL = "SERVER_URL"
    const options = {address: "0xe9e7cea3dedca5984780bafc599bd69add087d56", chain: "bsc"}
    tokenInfo = await Moralis.Web3API.token.getTokenPrice(options)
    console.log(tokenInfo)
    }

x();

Just tried this but still the same error

what you get if you run this:

const Moralis = require('moralis/node')
console.log(Moralis.CoreManager.get("VERSION"))

Found the issue. The connection was failing because I had proxy running on the background.

I’m having the same problem as Konflict
I have double checked that I have well indicated my Server URL, APP ID , Masterkey, API URL and API key in the index.js file as well as config.js.
I still get “Error [ERR_FR_MAX_BODY_LENGTH_EXCEEDED]: Request body larger than maxBodyLength limit”

as well as " ParseError: XMLHttpRequest failed: “Unable to connect to the Parse API”.
and Json metadata does not get generated.

Any chance you would know what could cause those errors, your help would be greatly appreciated .
Thank you so much in advance :slight_smile:

hi I have checked all the enviornment variables
NODE_ENV=dev

APP_ID=“Ky5U0w45UsFaLAB5xOOF2865JwXdgFs2ujX2krBD”

API_URL=“https://deep-index.moralis.io/api-docs/#/storage/uploadFolder

API_KEY=“myapikey in here”

SERVER_URL=“https://wimlepcpcnuo.usemoralis.com:2053/server

MASTER_KEY=“my master key in here”
how ever i get this error

Error: Request failed with status code 404
at createError (C:\moralis-mutant-nftengine\moralis-mutants-nft-engine\node_modules\axios\lib\core\createError.js:16:15)
at settle (C:\moralis-mutant-nftengine\moralis-mutants-nft-engine\node_modules\axios\lib\core\settle.js:17:12)
at IncomingMessage.handleStreamEnd (C:\moralis-mutant-nftengine\moralis-mutants-nft-engine\node_modules\axios\lib\adapters\http.js:293:11)
at IncomingMessage.emit (node:events:539:35)
at endReadableNT (node:internal/streams/readable:1345:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},

maybe you don’t have to add " here?

1 Like

thank you! here was the error
i was using the wrong API_url
https://deep-index.moralis.io/api-docs/#/storage/uploadFolder
i have change it to
API_URL=“https://deep-index.moralis.io/api/v2/ipfs/uploadFolder

1 Like

@cryptokid having the same issue here, i keep getting this error (screenshot attached)

Code is the following

import "../styles/globals.css";
import type { AppProps } from "next/app";
import { MoralisProvider } from "react-moralis";
import { MoralisDappProvider } from "../src/providers/MoralisDappProvider/MoralisDappProvider";

const APP_ID = "9mCJLhebtIbRti9XL8oVscBPIlCL6EBeFbrkoL7E";
const SERVER_URL = "https://xvebvq4ftwkf.usemoralis.com:2053/server";

function Example({ Component, pageProps }: AppProps) {
  const isServerInfo = APP_ID && SERVER_URL ? true : false;
  //validate
  if (!APP_ID || !SERVER_URL)
    throw new Error(
      "Missing Moralis Application ID and or SERVER URL. Make sure to set your .env file."
    );
  if (isServerInfo)
    return (
      <MoralisProvider
        appId={APP_ID}
        serverUrl={SERVER_URL}
        initializeOnMount={true}
      >
        <MoralisDappProvider>
          <Component isServerInfo {...pageProps} />
        </MoralisDappProvider>
      </MoralisProvider>
    );
}
export default Example;

appreciate your help!

this is all the code that you have?

1 Like

no i have a few pages and Components in a next app.

This is index.tsx:

import type { NextPage } from "next";
import Head from "next/head";
import { useMoralis } from "react-moralis";
import Header from "../src/components/Header/Header";
import Login from "../src/components/Login/Login";
const Home: NextPage = () => {
  const { isAuthenticated } = useMoralis();

  if (!isAuthenticated) return <Login />;
  return (
    <div className="flex min-h-screen flex-col">
      <Head>
        <title>IT</title>
        <link rel="icon" href="/favicon.ico" />
      </Head>
      <Header />
    </div>
  );
};

export default Home;

all of a sudden it works again!

1 Like