Unable to connect to the Parse API - Nodejs

Trying out nodejs. Ran into some problem while setting moralis up.

const Moralis = require("moralis/node");
Moralis.start({ serverUrl, appId, masterKey }); // tried both with and without the master key

await Moralis.Cloud.run("getData");

Returns error: 'XMLHttpRequest failed: "Unable to connect to the Parse API"'

Any idea what might be the problem?

I also tried fetching tokenPrice. But it returns an error of

errno: 'ECONNREFUSED',
code: 'ECONNREFUSED'

I did look at other threads in the forum but it did not help.
Moralis.CoreManager.get("VERSION") returns js0.0.178

Thank you for the help!

Does not seem to be working for me.
It returns Parse API error at the await Moralis.start({ serverUrl: "SERVER_URL", appId: "APP_ID" }); part.

you have to put there your server url and app id

Yes, of course I did put the url and appid in it.

Node version: v10.24.1
npm version : 6.14.12

did you also try my example posted above?
is your server working?
what is the version of Moralis SDK that you have?

Wierd. I seem to only have problem on the server.
The same thing is working in the localserver on my pc.

Updated npm and node in the server to match the one in my local pc. But it still shows the Parse API error.

maybe there is a connection problem from your server to your Moralis Server

Yup. Seems to be the problem with my server. I tried running it in another server and it works fine.
Thanks for the help!

I came across this error recently and it was because the server I was trying to connect to was sleeping. If you wake the server up or restart the server (reset) it, that will help to solve this error. You might need to wait about 5 minutes, but it will be back online!