'Unable to join {reason: "join crashed"}' for Channels tutorial

Hi guys, first question ever in this amazing forum.
I’m an Elixir (and Phoenix) newbie who spent some months learning and experimenting last year and currently getting back at it (Primary language is Python).

I’m interested in Channels and following this tutorial: https://hexdocs.pm/phoenix/channels.html
On the step where it says “Save the file and your browser should auto refresh, thanks to the Phoenix live reloader. If everything worked, we should see “Joined successfully” in the browser’s JavaScript console”, I get an error both in the browser console and CLI:
Browser: Unable to join {reason: "join crashed"}

[error] {:EXIT, {:undef, [{MychannelsWeb.RoomChannel, :start_link, [{%{}, {#PID<0.445.0>, #Reference<0.515670472.1991507970.133374>}, %Phoenix.Socket{assigns: %{}, channel: M
ychannelsWeb.RoomChannel, channel_pid: nil, endpoint: MychannelsWeb.Endpoint, handler: MychannelsWeb.UserSocket, id: nil, join_ref: "165", joined: false, private: %{}, pubsub
_server: Mychannels.PubSub, ref: nil, serializer: Phoenix.Socket.V2.JSONSerializer, topic: "room:lobby", transport: :websocket, transport_pid: #PID<0.445.0>}}], []}, {:superv
isor, :do_start_child_i, 3, [file: 'supervisor.erl', line: 379]}, {:supervisor, :handle_call, 3, [file: 'supervisor.erl', line: 404]}, {:gen_server, :try_handle_call, 4, [fil
e: 'gen_server.erl', line: 661]}, {:gen_server, :handle_msg, 6, [file: 'gen_server.erl', line: 690]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}}

The only difference with the tutorial is the App name ‘Mychannels’ (instead ‘Hello’).

Any pointers on what could be the problem?

Thanks in advance!

1 Like

Somewhere you have typo, probably MychannelsWeb instead of MyChannelsWeb.


Hi @hauleth, sorry for the typo, my application is actually ‘Mychannels’ and not ‘MyChannels’. I’ve updated by initial post.
I did create the phoenix app with the command mix phx.new mychannels (if I recall correctly).
But I’ll double-check for (uppercase) typos. Thanks for the hint!


According to the error MychannelsWeb.RoomChannel.start_link is undefined (it’s probably generated by use Phoenix.Channel).

Can you show the contents of your MychannelsWeb.RoomChannel module?


Welcome, You might also show the UserSocket.ex file :slight_smile:


Hi guys, thanks for all your comments and help! I think I found the issue and it’s quite embarassing. I copy/paste the RoomChannel definition from the tutorial but kept the defmodule line intact so ‘defmodule Hello.RoomChannel do’ instead of ‘defmodule MychannelsWeb.RoomChannel do

My bad :’|