Gigalixir deploy failing after upgrading to phoenix 1.5.0-rc.0

Am trying to deploy my app to Gigalixir after upgrading to phoenix 1.5.0-rc.0 but I get the following error.

   * Updating plug_crypto (Hex package)
remote: Dependencies have diverged:
remote: * plug (Hex package)
remote:   the dependency plug 1.8.3
remote:
remote:   > In deps/plug_cowboy/mix.exs:
remote:     {:plug, "~> 1.7", [env: :prod, hex: "plug", repo: "hexpm", optional: false]}
remote:
remote:   does not match the requirement specified
remote:
remote:   > In deps/phoenix/mix.exs:
remote:     {:plug, "~> 1.10", [env: :prod, hex: "plug", repo: "hexpm", optional: false]}
remote:
remote:   Ensure they match or specify one of the above in your deps and set "override: true"
 remote: ** (Mix) Can't continue due to errors on dependencies

These are my deps

defp deps do
[
  {:phoenix, "~> 1.5.0-rc.0", override: true},
  {:phoenix_pubsub, "~> 2.0"},
  {:phoenix_ecto, "~> 4.0"},
  {:ecto_sql, "~> 3.1"},
  {:postgrex, ">= 0.0.0"},
  {:phoenix_html, "~> 2.11"},
  {:phoenix_live_reload, "~> 1.2", only: :dev},
  {:gettext, "~> 0.11"},
  {:jason, "~> 1.0"},
  {:plug_cowboy, "~> 2.1"}
]
end

Its a problem with the plug dependency but am not sure how to fix it.

1 Like

Try this

{:plug, "~> 1.10", [env: :prod, hex: "plug", repo: "hexpm", optional: false, override: true]}
1 Like

Yes this seems to work. Though I wonder why it behaves like this.

It’s because your dependencies are requesting two different versions of plug, check your dependencies.

In this case plug_cowboy and phoenix

This makes sense. Is it a common problem when you are upgrading phoenix? I didn’t really do anything special apart from following the instructions for upgrading. What do you think is the best way to avoid it?

It is still a release candidate… it might be fixed for stable version.

1 Like

Phoenix 1.5 was released: https://hex.pm/packages/phoenix

2 Likes

Oh cool. I should probably upgrade to this.

I was getting this locally after upgrading to phoenix 1.5.0, using version 1.5.1 fixed the issue.

1 Like

So I’ve just tried pushing up my repo to gigalixir and i’m getting the same error as @samtechie.

As I mentioned above, I upgraded to 1.5.1. I’m not sure why when I changed Phoenix to 1.5.1 locally and ran mix deps.get I didn’t get the error again?

The fix by @Siel worked.

I also got 2 other deps that diverged when pushing up to gigalixir, I updated these as well and then my deployment to gigalixir went through.

Live dashboard requires :phoenix_html 2.14.1 or 2.15

remote:   > In mix.exs:
remote:     {:phoenix_html, "~> 2.11", [env: :prod, repo: "hexpm", hex: "phoenix_html"]}
remote:
remote:   does not match the requirement specified
remote:
remote:   > In deps/phoenix_live_dashboard/mix.exs:
remote:     {:phoenix_html, "~> 2.14.1 or ~> 2.15", [env: :prod, hex: "phoenix_html", repo: "hexpm", optional: false]}

and plug_cowboy

remote: * plug_cowboy (Hex package)
remote:   the dependency plug_cowboy 2.1.2
remote:
remote:   > In mix.exs:
remote:     {:plug_cowboy, "~> 2.1", [env: :prod, repo: "hexpm", hex: "plug_cowboy"]}
remote:
remote:   does not match the requirement specified
remote:
remote:   > In deps/phoenix/mix.exs:
remote:     {:plug_cowboy, "~> 1.0 or ~> 2.2", [env: :prod, hex: "plug_cowboy", repo: "hexpm", optional: true]}

This is what is currently in my deps

defp deps do
    [
      {:phoenix, "~> 1.5.1"},
      {:phoenix_pubsub, "~> 2.0"},
      {:phoenix_ecto, "~> 4.0"},
      {:phoenix_live_view, "~> 0.12.1"},
      {:phoenix_live_dashboard, "~> 0.1"},
      {:floki, ">= 0.0.0", only: :test},
      {:ecto_sql, "~> 3.1"},
      {:postgrex, ">= 0.0.0"},
      {:phoenix_html, "~> 2.14.1"},
      {:phoenix_live_reload, "~> 1.2", only: :dev},
      {:gettext, "~> 0.11"},
      {:jason, "~> 1.0"},
      {:plug_cowboy, "~> 2.2.1"},
      {:httpoison, "~> 1.6"},
      {:timex, "~> 3.0"},
      {:telemetry_poller, "~> 0.4"},
      {:telemetry_metrics, "~> 0.4"},
      {:plug, "~> 1.10", [env: :prod, hex: "plug", repo: "hexpm", optional: false, override: true]}
    ]
  end
1 Like

Just upgrading to 1.5.1 fixed the issue for me. I didn’t need to add @Siel’s fix.