Phoenix failing when releasing after upgrade to 1.7

I have an umbrella app with 4 apps that are using phoenix and I am trying to upgrade to phoenix 1.7 but I am getting the following warning message when releasing it to production:

warning: Phoenix.Flash.get/2 defined in application :phoenix is used by the current application but the current application does not depend on :phoenix. To fix this, you must do one of:
  1. If :phoenix is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs
  2. If :phoenix is a dependency, make sure it is listed under "def deps" in your mix.exs
  3. In case you don't want to add a requirement to :phoenix, you may optionally skip this warning by adding [xref: [exclude: [Phoenix.Flash]]] to your "def project" in mix.exs
Invalid call found at 2 locations:
  lib/admin_web/templates/layout/app.html.heex:133: AdminWeb.LayoutView."app.html"/1
  lib/admin_web/templates/layout/app.html.heex:138: AdminWeb.LayoutView."app.html"/1
Compilation failed due to warnings while using the --warnings-as-errors option

In my mix.exs I upgraded phoenix as follows {:phoenix, "~> 1.7.0", override: true} and also updated app.html.heex:

<%= if info = Phoenix.Flash.get(@flash, :info) do %>
        <p class="flash-card card-panel green darken-3 alert-info" role="alert">
          <%= info %>
        </p>
      <% end %>
      <%= if info = Phoenix.Flash.get(@flash, :error) do %>
        <p
          class="flash-card card-panel amber lighten-1 alert-danger"
          role="alert"
        >
          <%= info %>
        </p>
      <% end %>

I am not able to replicate the warning in dev mode. Does anyone have any idea of what I might be missing?

2 Likes

It seems to be a problem with the build cache when switching between branches.

mix clean --all will solve the problem

1 Like