Plug_cowboy seemingly not being recognised in distillery build

I am currently building a release package using distillery but am having issues running the app, seeing the error:

warning: please add the following dependency to your mix.exs:

    {:plug_cowboy, "~> 1.0"}

This dependency is required by Plug.Adapters.Cowboy
which you may be using directly or indirectly.
Note you no longer need to depend on :cowboy directly.

Which I’m a little confused about, given my mix.exs looks like:

 defp deps do
      {:phoenix, "~> 1.3.3"},
      {:phoenix_pubsub, "~> 1.1.0"},
      {:phoenix_ecto, "~> 3.2"},
      {:postgrex, ">= 0.0.0"},
      {:phoenix_html, "~> 2.6"},
      {:phoenix_live_reload, "~> 1.0", only: :dev},
      {:gettext, "~> 0.11"},
      {:plug_cowboy, "~> 1.0"},
      {:absinthe, "~> 1.4.2"},
      {:absinthe_plug, "~> 1.4.0"},
      {:absinthe_phoenix, "~> 1.4.0"},
      {:absinthe_relay, "~> 1.4.0"},
      {:distillery, "~> 2.0"},
      {:samly, "~> 0.8"},
      {:timex, "~> 3.1"},
      {:guardian, "~> 1.0"},
      {:comeonin, "~> 4.1"},
      {:bcrypt_elixir, "~> 1.0"},
      {:temp, "~> 0.4"},
      {:xml_builder, "~> 2.0.0"},
      {:jason, "~> 1.1.2"}

Everything runs fine when I run locally with mix phx.server, yet after doing:

MIX_ENV=prod mix do compile, phx.digest, distillery.init, distillery.release --env=prod

to build, then running:

_build/prod/rel/my_app/bin/my_app console

I’m seeing that error.

I’ve also tried wiping _build/, deps/ and mix.lock before doing mix deps.get and rebuilding to no avail.

Am I missing something here?

Many thanks in advance.

Can you show your def application function in the mix.exs file?

Of course:

 def application do
      mod: {MyApp, []},
      applications: [

Right so the issue is, don’t use the applications: . It was necessary a long, long time ago but hasn’t been necessary since. Replace it with:

extra_applications: [:logger, :runtime_tools]

Then everything will work fine.

Thanks for the quick reply!

Just to clarify, I should replace the whole of my applications list with exactly what you’ve supplied? i.e. :logger, :runtime_tools or I should replace applications: [ with extra_applications: [ and leave my list?

I’m testing the former now but thought clarifying here might help someone else in the future.

The function should look like:

 def application do
      mod: {MyApp, []},
      extra_applications: [:logger, :runtime_tools]
1 Like

Fantastic, thank you :+1:t3:

1 Like