ERROR: RequestError: Error: connect ECONNREFUSED

I am trying to use the HTTP Request flow and I keep getting this error. I am unable to hit my local server which I need to hit to process the information that I have in the payload. Since I can get emails from gmail I am making the assumption that the bridge network should allow me to also access my local server.

I have set the URL param to: http://localhost:4000/api

I checked the existing threads with the same error and none is conclusive in detailing how to resolve this issue.

How do you run n8n? With docker?

Yes. I am using the sample given in the withCompose section.
I’ve resorted to piping the calls to ngrok but would appreciate having a solution for this.

In this case is your docker configration wrong. If you want that docker-container uses the same network as your host you have to set it accordingly. Right now if you call localhost in n8n it will only reach the n8n-docker image and this one does not have anything which operates on port 4000 so a connection is not possible.

So you have to either have to:

  • use the public IP address of your host or
  • if it is another docker container you can link them and then use the name like myservice:4000 or
  • you have to set in the docker-file network_mode: host. But you then have to remove the ports as they are incompatible

Here the docker documentation:

1 Like