HTTPoison request failes on specific machine but works in another machine

599 Views Asked by At

Am doing a post with HTTPoison, on one machine everything works well, but in the other the same code, with similar environment parameters.

HTTPoison.post!("https://remote_api", "", [{"X-TOKEN", System.get_env("API_TOKEN"}, {"Content-Type", "application/json"}])

fails with

** (HTTPoison.Error) {:options, {:sslv3, {:versions, [:"tlsv1.2", :"tlsv1.1", :tlsv1, :sslv3]}}}
    (httpoison) lib/httpoison.ex:128: HTTPoison.request!/5

both machines are setup the same running centos7, but i get expected results in one but not in the other. am not sure what i got wrong

Downgrading to OTP 22 fixed it, thanks Aleksei Matiushkin.

3

There are 3 best solutions below

0
mind.blank On BEST ANSWER

Bumping hackney to version 1.16 worked for me.

 defp deps do
    [
      ...
      {:httpoison, "~> 1.6"},
      {:hackney, "~> 1.16"}
    ]
  end
0
balexand On

I'm having the same issue and it looks like this fix in hackney will resolve the problem. It's been merged to master but hasn't been released yet.

In the meantime, downgrading to OTP 22 is a good solution.

0
Andreas Eriksson On

This works for me for the moment:

{:hackney, git: "https://github.com/benoitc/hackney.git", branch: "master", override: true}