Heroku Deployment Woes

I’m attempting to deploy a bare-bones elixir app to Heroku. I keep getting the following error: `** (EXIT from #PID<0.74.0>) an exception was raised:

    ** (ArgumentError) supervisors expect the child to be a module, a {module, arg} tuple or a map with the child specification, got: {DBConnection.ConnectionPool, {Ecto.Repo.Supervisor, :start_child, [{DBConnection.ConnectionPool, :start_link, [{Postgrex.Protocol, [types: Postgrex.DefaultTypes, hostname: "localhost", port: 5432, repo: StarlinkConnector.Repo, telemetry_prefix: [:starlink_connector, :repo], otp_app: :starlink_connector, timeout: 15000, database: "starlink_connector_prod", pool_size: 2, pool: DBConnection.ConnectionPool]}]}, Ecto.Adapters.Postgres, #Reference<0.115686411.3922591746.186642>, %{opts: [timeout: 15000, pool_size: 2, pool: DBConnection.ConnectionPool], sql: Ecto.Adapters.Postgres.Connection, telemetry: {StarlinkConnector.Repo, :debug, [], [:starlink_connector, :repo, :query]}}]}, :permanent, 5000, :worker, [DBConnection.ConnectionPool]}
        (elixir) lib/supervisor.ex:609: Supervisor.init_child/1
        (elixir) lib/enum.ex:1255: Enum."-map/2-lists^map/1-0-"/2
        (elixir) lib/supervisor.ex:581: Supervisor.init/2
        (stdlib) supervisor.erl:294: :supervisor.init/1
        (stdlib) gen_server.erl:365: :gen_server.init_it/2
        (stdlib) gen_server.erl:333: :gen_server.init_it/6
        (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3`

I’ve added the build packs for both Elixir and Phoenix and specified my elixir version to be 1.7.x in both the mix.exs file and the elixir_buildpack.config. When I run heroku run "mix --version" though I get the following:

Running mix --version on ⬢ xxxxxxxxxxxx... up, run.8452 (Free)
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]

Mix 1.5.0

From googling I feel like Elixir 1.5 won’t actually work for what I’m doing but it seems Heroku is intent on using that for the project?

Please tell us exactly how you specified the version.

In mix.exs:

def project do
    [
      app: :my_app,
      version: "0.1.0",
      elixir: "~> 1.7",
      elixirc_paths: elixirc_paths(Mix.env()),
      compilers: [:phoenix, :gettext] ++ Mix.compilers(),
      start_permanent: Mix.env() == :prod,
      aliases: aliases(),
      deps: deps()
    ]
  end

And in elixir_buildpack.config:

always_rebuild=false
erlang_version=20.1
elixir_version=1.7.2
runtime_path=/app

Hmmm, what buildpack are you using and how did you set it?

try and flip the always_rebuild=false to true - so you get a (re!)build with the changes made to elixir_buildpack…

=== floating-dawn-11111 Buildpack URLs
1. https://github.com/HashNuke/heroku-buildpack-elixir.git
2. https://github.com/gjaldon/heroku-buildpack-phoenix-static.git

Set both via the CLI and in the Pipeline interface on Heroku.

The really strange thing is that during the build it says Elixir 1.7.2, but when trying to run mix commands (or start the app) it won’t work with an error innate to Elixir 1.5 and specifies Elixir 1.5 when running the command I linked above.

you are checking the mix version heroku run "mix --version" try and check the elixir version heroku run "elixir --version"

does your app run correctly in dev with the same erlang/elixir version?
(eg try and bump elixir to 1.7.4… think there was some incompatibilities recently against specific early 1.7.x versions…)

(and make sure to have always_rebuild=true when debugging heroku builds…)

If mix --version differs from elixir --version something even worse is going wrong.

oh yeah, my bad(didn’t know mix follow elixir versioning… :man_facepalming:) but definitely use always_rebuild=true which should pick up the specified elixir version then…

Yes everything runs fine locally. Again, this is just the base phx.new app, I haven’t done anything other than things to try to get it working on Heroku.

The actual error seems to have something to do with Ecto.

(ArgumentError) supervisors expect the child to be a module, a {module, arg} tuple or a map with the child specification, got: {DBConnection.ConnectionPool, {Ecto.Repo.Supervisor, :start_child, [{DBConnection.ConnectionPool, :start_link, [{Postgrex.Protocol, [types: Postgrex.DefaultTypes, hostname: "localhost", port: 5432, repo: StarlinkConnector.Repo, telemetry_prefix: [:starlink_connector, :repo], otp_app: :starlink_connector, timeout: 15000, database: "starlink_connector_prod", pool_size: 15, pool: DBConnection.ConnectionPool]}]}, Ecto.Adapters.Postgres, #Reference<0.1314834767.3961389057.13396>, %{opts: [timeout: 15000, pool_size: 15, pool: DBConnection.ConnectionPool], sql: Ecto.Adapters.Postgres.Connection, telemetry: {StarlinkConnector.Repo, :debug, [], [:starlink_connector, :repo, :query]}}]}, :permanent, 5000, :worker, [DBConnection.ConnectionPool]}

did always_rebuild=true in the elixir_buildpack.config solve it? (and subsequently using elixir 1.7.4)
(remember to git commit the change…)

it’s a known bug when running against elixir 1.5 https://github.com/phoenixframework/phoenix/issues/3238

Made that change to no effect.

I’m deploying using pipelines which trigger on commits to master so it’s definitely in the repo.

:frowning:

hmm, when you check heroku run “mix --version” which heroku app are you checking against? (staging or prod?)

have you promoted the deploy… is the build stuck on CI - can you do a manual deploy(should be a button in the interface…) - can you turn off CI…

believe there is an issue with the CI/pipeline currently… see https://github.com/HashNuke/heroku-buildpack-elixir/issues/135

I’m not actually running any CI, just deploying. I could try taking it out of the pipeline, but I don’t know how that would fix the issue. Just seems like Heroku is running the app under the wrong elixir version.

Could you please tell more about your deplyoment process?

Is the application built and deployed into the exact same environment that is used to run it afterwards or do you have a multi stage setup where you push to staging and then heroku promotes the staging to the new production afterwards? If the latter, it might be that the promotion process is broken.

And the tip to turn of CI is, as far as I understand, only for the case that you use heroku CI to test your application before deploying it. If though you use travis or circle or some other service external to heroku, I do not think, it would make a difference.

1 Like

Yup, see here: Ecto migration fails on Heroku - #6 by lukerandall

We have also updated the buildpack to use v1.5.3 by default in master.

I just went through the Phoenix Heroku deployment tutorial today, and got Elixir 1.5.0 and this error.
The buildpack seems not to be updated to 1.5.3 after all?
It worked by adding the config file.

thanks for feedback…

looks like https://github.com/phoenixframework/phoenix/blob/master/guides/deployment/heroku.md needs to be “backported” to the 1.4 branch…

I’ve created an issue for backporting it… https://github.com/phoenixframework/phoenix/issues/3360

1 Like

Is there a reason the buildpack itself is not updated to a newer Elixir?