Connect ECONNREFUSED 127.0.0.1:80

Hello, I’m trying to make several GET requests based on a Woocommerce order.
Basically, I get the line items and if, say, there are 5 different products in the order, I connect to the warehouse software to check the value in stock.
I’m using the HHTP Request node, and it only works with the first product.
In the second GET request to the custom API, it throws the error:

{

"status": "rejected",

"reason": {

"message": "connect ECONNREFUSED 127.0.0.1:80",

"name": "Error",

"stack": "Error: connect ECONNREFUSED 127.0.0.1:80 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)",

"code": "ECONNREFUSED"

}

}

Nodes:

Here some screenshots.


What could it be? I have updated n8n, restarted the server too and the error continues.
I’m using n8n with docker in Vultr.

Thanks in advance for your wisdom.

1 Like

Hey @th3liam, welcome to the community!

Looking at the URL expression in your HTTP Request node ({{$node["variables"].json["endpoint"]}}api/inventarios/inve/{{$node["Line Items"].json["sku"]}}/) it seems you are reading the URL from a variables node part of the workflow you have shared. Is there a chance your variables node only returns a single item?

If so, what would happen here is this: For the first item arriving at the HTTP Request node, it would look up the first item of your variables node which is working fine from the sounds of it. But for the second item it would try to retrieve the second item from your variables node which doesn’t exist.

So what you probably want to do here is add $item(0) to your expression so the HTTP Request node always fetches the first item, like so: {{$item(0).$node["variables"].json["endpoint"]}}api/inventarios/inve/{{$node["Line Items"].json["sku"]}}/

2 Likes

Thank you @MutedJam

It turned out to be a problem in the way I was refering to the node called “variables”

1 Like

Sweet, glad to hear you figured it out. Thanks for confirming!