Newly created app hangs on home page with error in "...Phoenix.LiveView.Channel.start_link/1"

After creating a new app with mix phx.new livetest --live --binary-id and following usual setup instructions, the app hangs permanently with loading spinner and I see the following error in the console when running mix phx.server and navigating to localhost:400

Clicking on LiveDashboard opens the Dashboard app which is not responsive to further interactions (the loading spinner persists).

Please share your ideas on how to fix this, appreciate your help!

image

(FunctionClauseError) no function clause matching in Phoenix.LiveView.Channel.start_link/1

Environment:

Erlang/OTP 23 [erts-11.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]
Elixir 1.10.3 (compiled with Erlang/OTP 21)

Console stack trace:

[info] GET /
[debug] Processing with Phoenix.LiveView.Plug.index/2
  Parameters: %{}
  Pipelines: [:browser]
[info] Sent 200 in 875µs
[info] CONNECTED TO Phoenix.LiveView.Socket in 379µs
  Transport: :websocket
  Serializer: Phoenix.Socket.V2.JSONSerializer
  Parameters: %{"_csrf_token" => "EEZxcDE2D2RQDHJfMVpeezxLQyk_YCs6hkF3xacW2ZG4u125k-6by5Mw", "vsn" => "2.0.0"}
[error] an exception was raised:
    ** (FunctionClauseError) no function clause matching in Phoenix.LiveView.Channel.start_link/1
        (phoenix_live_view 0.12.1) lib/phoenix_live_view/channel.ex:12: Phoenix.LiveView.Channel.start_link({LivetestWeb.Endpoint, {#PID<0.643.0>, #Reference<0.4273921409.1426587651.156349>}})
        (elixir 1.10.3) lib/dynamic_supervisor.ex:692: DynamicSupervisor.start_child/3
        (elixir 1.10.3) lib/dynamic_supervisor.ex:678: DynamicSupervisor.handle_start_child/2
        (stdlib 3.13) gen_server.erl:706: :gen_server.try_handle_call/4
        (stdlib 3.13) gen_server.erl:735: :gen_server.handle_msg/6
        (stdlib 3.13) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

Deps (mix and npm) are up to date:

 phoenix 1.5.3
 phoenix_live_view 0.12.1
6 Likes

You need to jump to LV 0.13 when running the latest phoenix so adding {:phoenix_live_view, "~> 0.13.0"} and mix deps.get will fix it :slight_smile:

22 Likes

Thanks Chris! Updating to LV 0.13 solved the issue.
Also thank you and all contributors for the awesome LiveDashboard app!
Just to note that when I go to LiveDashboard > Metrics > VM (tab) and switch to mobile view via Chromium’s dev tools I consistently see the following error (happens only for portrait mode) in the browser console, and no errors server-side:

6vm:104 Uncaught TypeError: Cannot read property '2' of undefined
    at vm:104
    at Array.map (<anonymous>)
    at Object.values (vm:104)
    at vm:104
    at Array.forEach (<anonymous>)
    at jt (vm:104)
    at Mt (vm:104)
    at Yt (vm:104)
    at vt (vm:104)
    at Object.i.setSize (vm:104)
    at e.value (vm:104)
    at e (vm:104)

Maybe this could hint about some issue with LV-related JavaScripts.

fixed or in the progress of being fixed here:

2 Likes

@dalerka please update both Phoenix and LiveView and the error should disappear, sorry for the trouble.

5 Likes

Just want to mention that as of today, I have the exact same problem when launching a new app based on LiveView mix phx.new my_app --live. mix.exs will contain {:phoenix_live_view, "~> 0.12.0"}.
Error:

** (FunctionClauseError) no function clause matching in Phoenix.LiveView.Channel.start_link/1

Changed to {:phoenix_live_view, "~> 0.14.4"}, but now the error is:

Request failed ({:failed_connect, [{:to_address, {‘repo.hex.pm’, 443}}, {:inet, [:inet], :nxdomain}]})
** (Mix) Package fetch failed and no cached copy available (https://repo.hex.pm/tarballs/phoenix_live_view-0.14.4.tar)

Update your phx_new installer with mix local.phx

Seems like hex.pm is having some connection issues. I was also getting similar errors earlier:

Failed to fetch record for 'hexpm/plug_cowboy' from registry (using cache instead)
:timeout

Indeed there is a problem with Hex. What do we do when that happens? How do we get the dependencies?

Anyway after an hour waiting or so, now it suddenly works.

Just read over on HN that there’s an ongoing Level 3 global outage. I wonder if “hex issues” were related to this.

2 Likes