Errno::ECONNREFUSED: Connection refused - connect(2) for "" port 80

Using ElasticSearch and Redis. A few specs that pass locally with rspec fail on Circle with the following error:

Failure/Error: let(:nomination)      { Nomination.create(user: user, url: "", approval_ballot: approval_ballot) }
Connection refused - connect(2) for "" port 80

From what I can tell this is maybe an issue with elasticsearch not running? Any advice would be appreciated.

Should add that I get this error when explicitly stating elasticsearch as a dependency, when installing a specific version of elastic search, or without any declaration that i need elasticsearch.

How exactly are you installing elasticsearch? From what I can tell, you are not using the pre-installed version, are you?

I’ve tried it all three ways. Installing my own version, declaring it in my machine services, and not doing anything at all and letting circle infer the correct version.

Not sure why are you expecting Elasticsearch to listen on the port 80—wasn’t the default port it would listen to 9200, as suggested here?

1 Like

Agreed, it is very unusual for elasticsearch to run on port 80.

So, after some more poking around, I think what’s happening is that a spec wasn’t properly stubbed. It’s trying to access a varnish configs, that are using port 80, and consequently throwing the error.


Awesome, glad you figured this out!