begedin
"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
%Conn{}- valid status number
%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.htmlfor signing up with a username and passwordnew.email.htmlfor 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.
Most Liked
kuzyn
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









