Missing clause of Phoenix.LiveView.Channel.gather_keys?

Hi,

another evening and I am still trying to work through this wonderful post by leanpanda.

Tonight I get a totally strange error again. Maybe I stumbled again into some kind of incompatibility like yesterday? I just created a resource using

mix phx.gen.live Properties Property properties user_id:references:users name:string price:decimal description:text

I can open the form to add a new property, but as soon as a type the first letter in the form, I get this error.

** (FunctionClauseError) no function clause matching in Phoenix.LiveView.Channel.gather_keys/2
    (phoenix_live_view 0.14.7) lib/phoenix_live_view/channel.ex:419: Phoenix.LiveView.Channel.gather_keys("", ["_csrf_token"])
    (phoenix_live_view 0.14.7) lib/phoenix_live_view/channel.ex:413: Phoenix.LiveView.Channel.decode_merge_target/1
    (phoenix_live_view 0.14.7) lib/phoenix_live_view/channel.ex:96: Phoenix.LiveView.Channel.handle_info/2
    (stdlib 3.13.2) gen_server.erl:680: :gen_server.try_dispatch/4
    (stdlib 3.13.2) gen_server.erl:756: :gen_server.handle_msg/6
    (stdlib 3.13.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

From the stack trace I can’t see any relationship to the generated code.

Any ideas? Any help on this?

Best regards
Oliver

1 Like

Got into the same problem…

I could fix it by reverting to plug 1.10.4 in my mix.lock

"plug": {:hex, :plug, "1.10.4", "41eba7d1a2d671faaf531fa867645bd5a3dce0957d8e2a3f398ccff7d2ef017f", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "ad1e233fe73d2eec56616568d260777b67f53148a999dc2d048f4eb9778fe4a0"},

while version 1.11.0 gave me same issues as your errors.

3 Likes

This did in indeed fix my problem. A tough way to solve it for someone who is currently learning.

Thanks a lot. Can this also be solved by adding a requirement to mix.exs?

1 Like

It was just a guess… after I updated and saw it was breaking with the error message You mention, I made a diff with the previous version and saw this line was modified in mix.lock.

The fix was to revert to previous version, but I don’t know what is the change.

@chrismccord and/or @josevalim provided a solution via phoenix_live_view 0.14.8. Awesome.

1 Like

To give a bit more context, this was a bug in the Plug library where we were not following the query decoding/encoding spec to the letter. Unfortunately fixing the bug broke LiveView which was matching on the unexpected return type.

2 Likes