Making http calls from within a code node (cloud version)

Describe the problem/error/question

My single biggest annoyance with n8n is that it does not seem to be possible to make http calls from the code nodes. With AI-assisted codings it’s often much faster to give Cursor/Claude/you-name-it some API docs and then one-shot a script with the right logic and the right API calls… Instead it takes me ages to click around n8n and piece the HTTP nodes together…

Is there any way around this?

Information on your n8n setup

  • n8n version: [email protected]
  • Running n8n via (Docker, npm, n8n cloud, desktop app): cloud

On cloud, the library you would need to do that (Axios) is not available in a code node. Guessing this is related to runtime security or other restrictions, but I’m not sure exactly why it isn’t permitted.

If you enable/allow Axios on a self-hosted n8n instance (with env var: NODE_FUNCTION_ALLOW_EXTERNAL=axios) , it works fine with code like this:

const axios = require("axios");
async function call() {
  const url = "https://httpbin.org/ip";
  const res = await axios.get(url);
  return res
}
result = await call();
return {
			body: result.data,
			headers: result.headers,
			statusCode: result.status,
			statusMessage: result.statusText,
		};

I’m curious though, if you want to do everything in JS code, what are you getting from n8n? Are you just using it as a way to deploy a service written in JS? Maybe the “way around it” would be to choose a better fitting deployment approach for this task/service, like writing a regular Nodejs app with Express or Nestjs framwork?

I thought what I’m still getting from n8n is the no-setup scheduling and triggers (like webhooks) and alerts and run history that I can look at when something crashed, but other than that I really just want to deploy a service written in JS you’re right (vibe coding is just getting too good these days) :thinking:

If I were making the same decision, it would come down to the tradeoff of convenience and flexibility. n8n is certainly a convenient platform to orchestrate multiple services and pass data from one to the next, but IMO it really isn’t intended (or ideal) for implementing complex logic.

An auditor for a development project I was on a few years ago compared software tools to office/art supplies. His analogy for an orchestration tool was glue, and other things were correlated to paper, pens, erasers, markers, staples, paperclips, etc. He was criticizing the use of the orchestration tool AS all of those things because the architects on the project had, for some reason (in his words), “chosen to use glue as paper, use glue as pens, use glue as erasers (someone noted dried glue might sorta work for this), use glue as markers, etc.” That analogy really “stuck” (pun intended) with me.