Skip to content

Instantly share code, notes, and snippets.

@moxley
Created August 12, 2019 00:29
Show Gist options
  • Save moxley/6493be3248a406fe3fdd3ac9ef744d7e to your computer and use it in GitHub Desktop.
Save moxley/6493be3248a406fe3fdd3ac9ef744d7e to your computer and use it in GitHub Desktop.
Phoenix LiveView error using handle_params/3

Error message:

[error] GenServer #PID<0.1901.0> terminating
** (MatchError) no match of right hand side value: :external
    (phoenix_live_view) lib/phoenix_live_view/channel.ex:152: Phoenix.LiveView.Channel.call_mount_handle_params/2
    (phoenix_live_view) lib/phoenix_live_view/channel.ex:443: Phoenix.LiveView.Channel.verified_mount/9
    (stdlib) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: {:mount, Phoenix.LiveView.Channel}

This is because the LiveView module is being called from a controller. The handle_params/3 callback is intended for LiveView modules that are called from the router. If you want to pass parameters into the LiveView, do so from the controller in the call to live_render/3.

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