HTTP Request Function Node

Hi everyone,
I would like to know if it were possible to send HTTP requests (i.e. fetch) in function nodes in n8n cloud.
Thank you in advance.
Alberto

Hi @Alberto_Marzetta, welcome to the community!

To make HTTP Requests right inside the Function node when using n8n.cloud, you could use request-promise-native and run a snippet like this:

const request = require('request-promise-native');

const options = {
  uri: 'https://www.themealdb.com/api/json/v1/1/random.php',
  method: 'GET',
  json: true
}

let result = await request(options);

return [{
  json: result.meals[0]
}];

Is this what you had in mind?

Thank you! yes. I had to do some basic authentication which I managed with ‘Request’ module.Thanks again

1 Like

is there a way to do this on self hosted, this code produces “ERROR: Cannot find module ‘request-promise-native’ [Line 170]”