Hi,
I'm a developer new to Elixir and Phoenix so I'm not really sure if this is an issue or a limitation.
Lately I've noticed that during a debugging session using VSCode and elixir-ls, if I edit an ex file (es a channel or a controller) and then I reload the frontend, a js app (svelte) that consume json apis and Phoenix channels, the app crashes with this error in the debugger console:
[error] an exception was raised: ** (UndefinedFunctionError) function MrChatWeb.UserChannel.start_link/1 is undefined (module MrChatWeb.UserChannel is not available) (mr_chat 0.1.0-fd30e365) MrChatWeb.UserChannel.start_link({MrChatWeb.Endpoint, {#PID<0.2177.0>, #Reference<0.833176470.3639083009.122332>}}) (elixir 1.14.0) lib/dynamic_supervisor.ex:745: DynamicSupervisor.start_child/3 (elixir 1.14.0) lib/dynamic_supervisor.ex:731: DynamicSupervisor.handle_start_child/2 (stdlib 3.17.2.1) gen_server.erl:721: :gen_server.try_handle_call/4 (stdlib 3.17.2.1) gen_server.erl:750: :gen_server.handle_msg/6 (stdlib 3.17.2.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
After some digging I discovered that the corresponding beam compiled file disappears from _build/dev/lib/mr_chat/ebin
, almost like it was deleted before recompilation but never recompiled.
Restarting the debugging session fix the behaviour until the next edit.
Everything works fine if I start the project with mix phx.server
or iex -S mix phx.server
This behaviour is present in a fresh project too.
https://github.com/fnicastri/test_phoenix_vscode
just edit lib/test_web/controllers/page_controller.ex during a VSCode debug session and reload the webpage, you will get an error and the page_controller.beam file disappears from _build/dev/lib/test/ebin
.
Anyone can help? Restarting the session after every edit is painfully slow.
Thanks
Francesco
Elixir 1.13.4 (compiled with Erlang/OTP 24)
Same behaviour with OTP 25 and Elixir 1.14
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4