ERROR: RequestError: Error: connect ECONNREFUSED 127.0.0.1:7777

I´m running N8N with docker, the container shares the network with the API. I´m using a http request, triggered by a cron. Nevertheless, sometimes it works and the request runs, but othertimes it fails with the ECONNREFUSED 127.0.0.1:7777 error. There´s no pattern, it seems very random.

The Cron, triggers the request once a week, I have set the URL param to: http://back-end:7777`, and set the body elements of the request.

Hi @AntPRZ, welcome to the community!

I’m sorry to hear you’re having trouble. ECONNREFUSED isn’t an n8n specific error, but rather a system error indicating a network problem. So this would suggest an error with your infrastructure.

Since you mentioned that you are using http://back-end:7777 but the error message suggests the problem occurred on 127.0.0.1:7777. A few conversations on Stack Overflow suggested the HTTP request library axios which is used here defaults to 127.0.0.1 if it can’t find the specified URL, though I could not reproduce this myself tbh.

Is there a chance your back-end host was (briefly) unable to handle your request for any reason? If so, could try using the Retry On Fail setting of the HTTP Request node to retry the request after a short wait:

image

That worked out! Thank you!

1 Like

Oh nice, thanks for confirming!