Phoenix: Deprecation warning in Router.pipeline/1 with Plug 1.5.1

Created on 17 May 2018  路  9Comments  路  Source: phoenixframework/phoenix

Plug 1.5.1 deprecated Plug.Conn.WrapperError.reraise/3, which is used in the Router.pipeline/1 macro in the latest released version of Phoenix.

Although this deprecation is fixed on master, I think it should be backported to the v1.3 branch because any apps which update to Plug 1.5.1 will get a build failure if they build with --warnings-as-errors.

Environment

  • Elixir version (elixir -v): 1.6.5
  • Phoenix version (mix deps): 1.3.2

Most helpful comment

For reference, here's how you can modify your mix.exs file to exclude this specific deprecation warning, as @josevalim suggested.

  def project do
    [
      ...
      xref: xref()
    ]
  end

  defp xref do
    [
      exclude: [
        {Plug.Conn.WrapperError, :reraise, 3}
      ]
    ]
  end

All 9 comments

@xtian you can also configure xref to exclude those deprecation warnings for now. See mix help xref. The problem with fixing those right now is because it would impose a requirement on Plug v1.5.1 and I don't think we should not force deps to update their plug version in a minor update.

Our travis build also just hit this because we run with --warnings-as-errors.

As Jos茅 said, xref exclusions would be the way to go as we can't push plug 1.5.1 on all users. Thanks!

For reference, here's how you can modify your mix.exs file to exclude this specific deprecation warning, as @josevalim suggested.

  def project do
    [
      ...
      xref: xref()
    ]
  end

  defp xref do
    [
      exclude: [
        {Plug.Conn.WrapperError, :reraise, 3}
      ]
    ]
  end

Or you could downgrade plug to 1.5.0 as pointed out in the forums

This should be fixed in Phoenix 1.3.3

@john-griffin For CI it's better to compile in two passes. First mix deps.compile and then mix compile --warnings-as-errors. Then warnings in dependencies won't bother your workflow :).

@AndrewDryga The problem here is that the warnings was caused by the macros used in the MyApp.Router module. This means that the warning is displayed as part of your application, and not as a warning in a dependency.

@AndrewDryga --warnings-as-errors will not error if warnings came from deps. (Not sure if this behaviour changed between Elixir versions.)

Was this page helpful?
0 / 5 - 0 ratings