Faraday::ConnectionFailed: Empty reply from server
slhck opened this issue · 1 comments
slhck commented
I am getting the following error while calling a method against the Elastic server:
Faraday::ConnectionFailed:
Empty reply from server
# /usr/local/bundle/gems/patron-0.13.3/lib/patron/session.rb:330:in `handle_request'
# /usr/local/bundle/gems/patron-0.13.3/lib/patron/session.rb:330:in `request'
# /usr/local/bundle/gems/faraday-patron-1.0.0/lib/faraday/adapter/patron.rb:32:in `block in call'
# /usr/local/bundle/gems/faraday-1.5.1/lib/faraday/adapter.rb:51:in `connection'
# /usr/local/bundle/gems/faraday-patron-1.0.0/lib/faraday/adapter/patron.rb:29:in `call'
# /usr/local/bundle/gems/faraday-1.5.1/lib/faraday/rack_builder.rb:154:in `build_response'
# /usr/local/bundle/gems/faraday-1.5.1/lib/faraday/connection.rb:495:in `run_request'
# /usr/local/bundle/gems/elastic-apm-4.3.0/lib/elastic_apm/spies/faraday.rb:54:in `run_request'
# /usr/local/bundle/gems/elasticsearch-transport-7.13.3/lib/elasticsearch/transport/transport/http/faraday.rb:48:in `block in perform_request'
# /usr/local/bundle/gems/elasticsearch-transport-7.13.3/lib/elasticsearch/transport/transport/base.rb:288:in `perform_request'
# /usr/local/bundle/gems/elasticsearch-transport-7.13.3/lib/elasticsearch/transport/transport/http/faraday.rb:37:in `perform_request'
# /usr/local/bundle/gems/elasticsearch-transport-7.13.3/lib/elasticsearch/transport/client.rb:192:in `perform_request'
# /usr/local/bundle/gems/elastic-apm-4.3.0/lib/elastic_apm/spies/elasticsearch.rb:44:in `perform_request'
# /usr/local/bundle/gems/elasticsearch-api-7.13.3/lib/elasticsearch/api/namespace/common.rb:38:in `perform_request'
# /usr/local/bundle/gems/elasticsearch-api-7.13.3/lib/elasticsearch/api/actions/indices/delete.rb:51:in `delete'
# /usr/local/bundle/gems/elasticsearch-model-7.1.1/lib/elasticsearch/model/indexing.rb:290:in `delete_index!'
I am using the elasticsearch (7.13.3) Gem with elasticsearch-model (7.1.1).
I have set the correct server host:
analytics_url = ENV.fetch("ANALYTICS_URL", "")
Elasticsearch::Model.client = Elasticsearch::Client.new(
url: analytics_url,
transport_options: {
ssl: { verify: false }
}
)
The environment variable is present as http://user:password@hostname:9200
.
slhck commented
I am directly answering this myself to help future users, since the error message is not very obvious.
The issue was that the Elasticsearch server was expecting HTTPS connections and not HTTP.
After setting the URL to use https
, it worked.