Weird error with phoenix_live_view on Heroku

I’m getting a super weird error when deploying an app with phoenix_live_view on Heroku:

09:33:03.143 [error] Ranch listener ReporterWeb.Endpoint.HTTP had connection
process started with :cowboy_clear:start_link/4 at #PID<0.576.0> exit with
reason: {:function_clause, [{Phoenix.Socket.Message, :from_map!, [["8", "8",
"lv:phx-oZOgz4XU", "phx_join", nil]], []}, {Phoenix.Socket, :__in__, 2, [file:
'lib/phoenix/socket.ex', line: 564]}, {Phoenix.Endpoint.Cowboy2Handler,
:websocket_handle, 2, [file: 'lib/phoenix/endpoint/cowboy2_handler.ex', line:
93]}, {:cowboy_websocket, :handler_call, 6, [file:
'/tmp/build_cae110e886c5c6dcb00c2dec21bb2a2f/deps/cowboy/src/cowboy_websocket.erl',
line: 482]}, {:cowboy_http, :loop, 1, [file:
'/tmp/build_cae110e886c5c6dcb00c2dec21bb2a2f/deps/cowboy/src/cowboy_http.erl',
line: 231]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line:
249]}]}

Any idea what could be wrong here?

Ok, it looks like for whatever reason when running the live view socket on Heroku, it uses Phoenix.Socket.V1.JSONSerializer instead of Phoenix.Socket.V2.JSONSerializer. However another (older socket before I implemented live view) does use Phoenix.Socket.V2.JSONSerializer!

I got it working, see the cross post on GitHub for more info here.

2 Likes