Reputation: 366
I've got a rails 5 app deployed to heroku and I'm using the Bonsai Elasticsearch plugin. I've got it configured so it is indexing and searching properly from localhost, but failing in production
I have the following gems installed per the instructions here for v6.x:
gem 'bonsai-elasticsearch-rails', '~> 6'
gem 'elasticsearch-model', github: 'elastic/elasticsearch-rails', branch: '6.x'
gem 'elasticsearch-rails', github: 'elastic/elasticsearch-rails', branch: '6.x'
When attemping to search or create an index I get the following error only in prod:
Faraday::SSLError (SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol)
Also probably worth noting I'm using the sandbox version of Bonsai and a paid heroku dyno with autoconfigured SSL.
Upvotes: 0
Views: 268
Reputation: 366
I got in touch with Bonsai support and they offered the following information which resolved my issue:
Thanks for reaching out. The problem may be due to a breaking change Elastic introduced into the Ruby client (see the discussion here). Elastic has indicated that they're not planning to fix it.
The simple fix is to append :443 to the end of your cluster URL. In other words, something like this:
https://:@*.eu-west-1.bonsaisearch.net:443
Basically, they switched the default port from 443 to 9200 which broke many existing apps.
Upvotes: 0