1
votes

I've a project running on my local machine using:

Erlang with openssl: Version 18.0
Elixir: Version 1.3.4

I installed both of them using asdf. Everything works fine. But when I try to connect to database it always gives me the following error:

unhandled exit at GET /ad_units/Y9Gd1kAiPCv8WOrE exited in: :gen_server.call(#PID<0.469.0>, {:checkout, #Reference<0.0.6.2529>, true, 15000}, 5000) ** (EXIT) an exception was raised: ** (CaseClauseError) no case clause matching: [10, 7, 7, 18, 4, 1] (postgrex) lib/postgrex/utils.ex:39: Postgrex.Utils.parse_version/1 (postgrex) lib/postgrex/extensions/void.ex:5: Postgrex.Extensions.Void.init/2 (postgrex) lib/postgrex/types.ex:56: anonymous fn/2 in Postgrex.Types.prepare_extensions/2 (elixir) lib/enum.ex:1115: anonymous fn/4 in Enum.into/3 (elixir) lib/enum.ex:1623: Enum."-reduce/3-lists^foldl/2-0-"/3 (elixir) lib/enum.ex:1121: Enum.into/4 (postgrex) lib/postgrex/protocol.ex:434: Postgrex.Protocol.bootstrap_send/3 (postgrex) lib/postgrex/protocol.ex:69: Postgrex.Protocol.connect/1 (db_connection) lib/db_connection/connection.ex:114: DBConnection.Connection.connect/2 (connection) lib/connection.ex:623: Connection.enter_connect/5 (stdlib) proc_lib.erl:239: :proc_lib.init_p_do_apply/3

I'm using Ubuntu 18.04 and PostgreSQL 10. BTW, I can connect to the postgres using a Ruby on Rails project and it's working fine. I tried to remove the build and then mix deps.get && mix deps.compile, but still the same.

Any idea what's the issue?

UPDATE

mix.deps dependencies:

defp deps do
    [{:phoenix, "~> 1.1.6"},
      {:postgrex, ">= 0.0.0"},
      {:phoenix_ecto, "~> 2.0"},
      {:phoenix_html, "~> 2.4"},
      {:phoenix_live_reload, "~> 1.0"},
      {:gettext, "~> 0.9"},
      {:cowboy, "~> 1.0"},
      {:phoenix_slime, "~> 0.6.0"},
      {:timex, "~> 2.2"},
      {:tzdata, "~> 0.1.8", override: true},
      {:timex_ecto, "~> 1.1.3"},
      # {:quantum, ">= 1.7.1"},
      {:exrm, "~> 1.0" },
      {:edeliver, ">= 1.2.10"},
      {:browser, "~> 0.1.0"}]
  end
1
It appears that the postgres version information is in a state that postgrex does not understand. There might be a few too many digits: github.com/elixir-ecto/postgrex/blob/master/lib/postgrex/…bogertron
@bogertron, In that case what should I do?Emu
Why do you use ancient versions of both OTP and Elixir? What is your mix.exs’ dependencies section states?Aleksei Matiushkin
@AlekseiMatiushkin, I've updated the question. Added the mix.exs dependenciesEmu
I am pretty sure the issue is this project is stuck to very old versions of everything, including postgrex driver which does not support PostgreSQL 10 versions. Is there any issue to upgrade everything to somewhat more up-to-date? Or you might downgrade your PostgreSQL.Aleksei Matiushkin

1 Answers

1
votes

I downgraded the postgres version from 10.7 to 9.5. It's working like a charm!

The version of postgrexadapter used in the project doesn’t have the upgrades to connect to PostgreSQL versions > 9.5.

Maybe it'll help someone else in future.

Thanks @AlekseiMatiushkin for your comment.