patreeceeo
My phoenix app starts up fine, but as soon as I modify any elixir source files the above error begins to occur repeatedly. This is the reason it gives:
{:undef, [{MusicJamGameWeb.RoomChannel, :child_spec, [{MusicJamGameWeb.Endpoint, {pid<0.1281.0>, reference<0.623636450.1826357254.163247>}}], }, {Phoenix.Channel.Server, :join, 4, [file: ‘lib/phoenix/channel/server.ex’, line: 24]}, {Phoenix.Socket, :handle_in, 4, [file: ‘lib/phoenix/socket.ex’, line: 598]}, {Phoenix.Endpoint.Cowboy2Handler, :websocket_handle, 2, [file: ‘lib/phoenix/endpoint/cowboy2_handler.ex’, line: 145]}, {:cowboy_websocket, :handler_call, 6, [file: ‘/home/patrick/Code/music_jam_game/deps/cowboy/src/cowboy_websocket.erl’, line: 528]}, {:cowboy_http, :loop, 1, [file: ‘/home/patrick/Code/music_jam_game/deps/cowboy/src/cowboy_http.erl’, line: 257]}, {:proc_lib, :init_p_do_apply, 3, [file: ‘proc_lib.erl’, line: 226]}]}
So far I’ve just been following the guide on using channels (Channels — Phoenix v1.8.8) trying to get a channel up and running. I’ll push my code to GH in case that helps. Also possibly unrelated but the messages pushed on to the channel by the JS are not being received in my handle_in callback. I’m stumped.
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #iex
- #graphql
- #ai
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex











Showing Posts 1 to 9- Show Best Posts
- Show All Posts (oldest first)
- Show All Posts (newest first)
beepbeepbopbop
Could be off but check your channel module name in GH: (https://github.com/patreeceeo/music_jam_server/blob/main/lib/music_jam_game_web/channels/room_channel.ex#L1)
HelloWeb.RoomChannel != MusicJamGameWeb.RoomChannelThe clue was the module name in
user_socket.ex: MusicJamGameWeb.RoomChannel,.patreeceeo
That was certainly an issue but alas still seeing the above issues after fixing that.
beepbeepbopbop
Are you sure? I’ve pulled down your repository, updated
room_channel.exand the problem goes away.patreeceeo
Yes, I’m sure.
Just curious if you were able to reproduce the issue? since “goes away” implies it was there. Please note the error doesn’t appear right away. I haven’t determined exactly what triggers it, but it takes some time (less than a minute) and/or interaction before it starts.
I’m going to start over with an earlier version of Elixir (using 1.13 now) and hope that I don’t run in to this again.
patreeceeo
Also I’ve noticed a couple similar error reports around the internet. For one, the root cause had to do with the Elixir linter Vim plugin. For the other, the user had “an extra redirect.” Neither of these cases seem to apply here.
patreeceeo
Also I’m using
patreeceeo
FWIW I started a fresh new project, channels are working and the error is gone. I probably klutzed something, but I also switched to Elixir 1.12. Later I’ll try again with 1.13 just in case.
patreeceeo
To my surprise, trying this same procedure again with Elixir 1.13 reproduced the same error message. I spun up a new project with phx_new, followed the official Channels guide, and the error started immediately. I pushed the code here: GitHub - patreeceeo/cowboy-opaque-error-min-repro: I believe this to be a minimal reproduction of a crash that occurs in Cowboy with correct (?) Phoenix code on Elixir 1.13 · GitHub. It wouldn’t be so bad if the error actually gave some useful info. Instead of a human-friendly message I just see :undef.
Here’s the error message again:
beepbeepbopbop
I’ve pulled your repo down as is and it fails, but once I add the channel module definition, it works as intended. In your reproduction repo, your channel module does not exist and any attempt to join a channel should fail. In fact, if you read your error message carefully, you can actually guess what it’s trying to do. Now, it does require some experience, but I can walk you through my thought process.
There are two halves of these error that are important to us:
:undef, [{MusicJamServerWeb.RoomChannel, :child_spec, [{MusicJamServerWeb.Endpoint, {#PID<0.5779.0>, #Reference<0.3249608392.111935491.56526>}}], []},and then every under it. What this looks like is a trace, specifically a function trace. You can tell since the output reads like a MFA (module-function-arguments). MFA are typically used with
apply/3, so things likeapply(String, :at, ["example", 2])are used for somewhat dynamic calls. Now, take a look at first line:{MusicJamServerWeb.RoomChannel, :child_spec, [{MusicJamServerWeb.Endpoint, {#PID<0.5779.0>, #Reference<0.3249608392.111935491.56526>}}]This is definitely a MFA like structure, a module, a function atom and the leading arguments. So for one, if we assume that this is the case, the module
MusicJamServerWeb.RoomChannelmust exist, but it does not in your repository. Furthermore, the:child_specfunction is critically important in Erlang; it defines the specification to start child processes. With that being said, we can check the Phoenix socket code for this behaviour: phoenix/lib/phoenix/channel/server.ex at v1.6 · phoenixframework/phoenix · GitHubHere the channel is expected to have a function
child_spec/1, but since the module is undefiined, you’ll run into the exact problem you have. This can easily be replicated here:If you go back to the Phoenix code, it attempts to start the child process based off that child specification call, but since you’re trying to call a function that doesn’t exist, it outright fails.