CaseClauseError in LiveView Channel

I had a strange CaseClauseError earlier when my app reloaded while reacting to a fresh deploy. Is this error something I’ve missed, or possibly a bug in LiveView?

channel.ex 1001 verified_mount/8
lib/phoenix_live_view/channel.ex:1001:in `verified_mount/8’

no case clause matching: %Phoenix.LiveView.Route
{
  path: ["trips", "73aa7d4c-1324-4acb-8724-1c0c04c56153"],
  view: IdoWeb.TripLive.Show, action: :show,
  opts: [action: :show, router: IdoWeb.Router],
  live_session: %{extra: %{on_mount: [%{function: &IdoWeb.UserAuth.on_mount/4,
    id: {IdoWeb.UserAuth, :ensure_authenticated}, stage: :mount}]},
  name: :require_authenticated_user, vsn: 1674007287466869182},
  params: %{"id" => "73aa7d4c-1324-4acb-8724-1c0c04c56153"},
  uri: %URI{scheme: nil, userinfo: nil, host: nil, port: nil,
  path: "/trips/73aa7d4c-1324-4acb-8724-1c0c04c56153", query: nil, fragment: nil}
}
2 Likes

I’m still having these errors fairly often and am stumped as what’s causing them. They’re frequently after I push a new release and my browser reconnects to the updated server. But today it happened when my wifi went out for a bit and the browser tried to reconnect. Are there any parts of the Route that look out of place to cause this match error?

I think all my Route and UserAuth code is just straight out of phx.gen.auth, but I maybe missed some fixes in one of the 1.7 RCs.

Can you please open up an issue if you haven’t yet with all this context? The client may be submitting some partial information on reconnection cases.

Please include the LV package version and make sure you are running a LV client that is up to date with the package.

Sure! I figured the mistake was somewhere on my side but that would be a relief if it’s just a bug.

I’ve opened 2518 in LiveView’s issues.

Thanks!

Maybe a bit late, But im having the same issue using latest Phoenix Framework 1.7.7 at the moment. Receive this error when try to set redirection after cancel modal on liveview

Yeah, the bug as far as I’ve narrowed it down is caused by JS.patch( + lost socket (either by an offline event or a server restart.)

I was experiencing this issue as well. I realized that the route being passed to JS.patch was not within the same LiveView but still within the same LiveSession.

Once I added some logic to switch between JS.patch and JS.navigate depending on the route, I didn’t experience any further errors.

I used this as a reference: Phoenix LiveView: When to use navigate, patch, href, redirect, push_patch, push_navigate - DEV Community.

I haven’t had this issue ever since the fix was pushed to LiveView back in March. Before then I had constant errors after deploys or loss of connectivity.

1 Like