"No function clause matching in Plug.Conn.resp/3" when upgrading to 1.7

This is something that took a while for me to debug, so I’m posting it in the hopes that it speeds up someone else’s work. I’ve been getting this error with the arguments listed for the function being

  1. %Conn{}
  2. valid status number
  3. %Phoenix.LiveView.Rendered{}

The problem is, it looks like the logic to infer the rendered format has shifted slightly. I’ve been using this non-started approach to organize my templates in a flat structure, where I had

  • new.password.html for signing up with a username and password
  • new.email.html for signing up with just an email

Prior to 1.7, the format was correctly inferred as html. Now, however, it’s being inferred as password.html.

So my solution to get tests to pass was to replace

render(conn, "new.password.html", assigns)

with

render(conn, :"new.password", assigns)

in my controllers respectively.

Long term, I will of course fully migrate, but for now, the error was kind of cryptic and the only way to fully figure it out was to generate a new 1.7 app, based on that, add formats: [:html] to my use Phoenix.Controller in my_app_web.ex and then the error message became less cryptic, saying “password.html” is an invalid format.

3 Likes