Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Phoenix 0.16.x to 0.17.0 upgrade instructions


Bump your :phoenix and :phoenix_live_reload deps in mix.exs:

def deps do
   {:phoenix, "~> 0.17"},
   {:phoenix_live_reload, "~> 1.0"},


The :render_errors: [default_format: "html"] is deprecated in favor of render_errors: [accepts: ["html"]]. Update your deprecated references in config/*.exs

plug :router is no longer needed and has been removed. Update your plug :router, Myapp.Router to plug Myapp.Router.


The "format" param for overriding the accept header has been renamed to "_format" and is no longer injected into the params when parsing the Accept headers. Use get_format/1 to access the negotiated format. If you were relying on the format param being present to match in the controller, such as:

def show(conn, %{"id" => id, "format" => "html"}) do ...

You can still support this style by using a simple plug to place the format param. For example:

defmodule MyApp.Router do

  pipeline :browser do
    plug :put_format_param
  defp put_format_param(conn, _) do
    put_in conn.params["_format"], Phoenix.Controller.get_format(conn)


In order to test channels, one must now explicitly create a socket and pass it to subscribe_and_join. For example,

subscribe_and_join(MyChannel, "my_topic")

should now become

socket() |> subscribe_and_join(MyChannel, "my_topic")
# or
socket("user:id", %{user_id: 13}) |> subscribe_and_join(MyChannel, "my_topic")

This pairs nicely with testing the UserSocket by simply call the module directly, for exampe:

{:ok, _, socket} =
  UserSocket.connect(%{"some" => "params"}, socket())
  |> subscribe_and_join(RoomChannel, "rooms:lobby", %{"id" => 3})
Copy link

PerishableDave commented Aug 23, 2015

I think :phoenix_ecto and :phoenix_html get a version bump as well. Was wondering why I couldn't use Ecto's unique_constraint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment