Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phoenix error in deployment: module Connection is not available

I'm working on a Phoenix application and have run into a problem in production that I'm having trouble debugging.

** (UndefinedFunctionError) undefined function: Connection.start_link/2 (module Connection is not available)^M Connection.start_link(Postgrex.Connection, [hostname: "localhost", timeout: 5000, otp_app: :xxx, repo: xxx.Repo, adapter: Ecto.Adapters.Postgres, username: "xxx", password: "xxx", database: "xxx", extensions: [{Ecto.Adapters.Postgres.DateTime, []}, {Postgrex.Extensions.JSON, [library: Poison]}], port: 5432])^M (ecto) lib/ecto/adapters/connection.ex:27: Ecto.Adapters.Connection.connect/2^M (ecto) lib/ecto/pools/poolboy/worker.ex:58: Ecto.Pools.Poolboy.Worker.handle_call/3^M (stdlib) gen_server.erl:629: :gen_server.try_handle_call/4^M (stdlib) gen_server.erl:661: :gen_server.handle_msg/5^M (stdlib) proc_lib.erl:240: :proc_lib.init_p_do_apply/3^M

  • The application has no such trouble on my development machine
  • The application is running on my production machine, but pages with database access are failing with this error
  • Changes from previous hassle-free application that could be affecting this include:
    1. a more recent version of Phoenix
    2. Elixir 1.1 vs 1.0; more recent versions of Postgrex, Ecto, Exrm etc.;
    3. I'm attempting to use boldpoker/edeliver rather than a Mina recipe I had previously concocted; but I have been having a hard time edeliver has been a rocky road.
like image 440
Gordon Isnor Avatar asked Dec 24 '22 10:12

Gordon Isnor


1 Answers

Yes, it is a bug in Postgrex which is fixed on master. Just add :connection to the list of applications in your mix.exs file.

like image 71
José Valim Avatar answered Jan 17 '23 15:01

José Valim