TypeError: Moralis.Cloud.httpRequest is not a function

Hi,

I am Receiving this error within a function, what am i doing wrong? Thank You.

const Moralis = require(“moralis/node”);
const { timer } = require(“rxjs”);

async function fancyFunction() {

const result = await Moralis.Cloud.httpRequest({
url: “www.blah.com/1.json”,
headers: {
‘Content-Type’: ‘application/json;charset=utf-8’
}
});

console.log(result);

}

fancyFunction()

I think that Moralis.Cloud.httpRequest works only in cloud code and not in a local nodejs script

ah alright thanks, is there another way to grab json data? Hmm

From https://docs.moralis.io/moralis-server/cloud-code/httprequest

Moralis Server includes Moralis.Cloud.httpRequest . It allows you to send HTTP requests to any HTTP server. This function takes an options object to configure the call.

you can do that from a cloud function, but the syntax that you pasted there for the entire code doesn’t look like cloud code

thanks yes your right just watched the video tutorial! thanks for your help!