Error while debugging Phoenix app. Ubuntu 24 + IntelliJ Ultimate

Hello!

I am a PHP and Go developer. This weekend I wanted to give it a try to Elixir & Phoenix but I run into some debugging issues that I am not able to resolve.

These are the versions of my current OS and tools:

  • Ubuntu 24.04.1 LTS
  • asdf v0.14.1-f00f759
  • Erlang 27.1
  • Elixir 1.17.3
  • Mix 1.17.3
  • IntelliJ IDEA 2024.2.2 (Ultimate Edition) Build #IU-242.22855.74, built on September 18, 2024
  • KronicDeth/intellij-elixir v19.0.1

I created a hello_elixir Phoenix project mix phx.new hello_elixir, I configured the db mix ecto.create and I started the app mix phx.server. I went to http://localhost:4000 and the app loaded correctly, here is the terminal output :

[info] Running HelloElixirWeb.Endpoint with Bandit 1.5.7 at 127.0.0.1:4000 (http)
[info] Access HelloElixirWeb.Endpoint at http://localhost:4000
[watch] build finished, watching for changes...

Rebuilding...

Done in 451ms.
[info] GET /
[debug] Processing with HelloElixirWeb.PageController.home/2
  Parameters: %{}
  Pipelines: [:browser]
[info] Sent 200 in 120ms

I made sure the app could run using Interactive Elixir iex -S mix phx.server, it ran correctly.

I went ahead and opened the project in the IDE and configure the Project Structure, here some screenshots (as a new user in the forum it won’t let me paste image directly):

Here is the debug configuration I tried:

Result of running the configuration:

/home/nico/.asdf/installs/erlang/27.1/bin/erl -pa /home/nico/.asdf/installs/erlang/27.1/lib/observer-2.16/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/tftp-1.2.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/kernel-10.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/megaco-4.6/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/wx-2.4.3/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/parsetools-2.6/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/os_mon-2.10/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/ssh-5.2.2/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/mnesia-4.23.2/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/tools-4.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/stdlib-6.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/inets-9.3/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/snmp-5.17/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/diameter-2.4.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/edoc-1.3.2/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/asn1-5.3.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/odbc-2.15/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/syntax_tools-3.2.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/crypto-5.5.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/public_key-1.16.2/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/eldap-1.2.13/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/runtime_tools-2.1.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/eunit-2.9.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/debugger-5.4/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/erts-15.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/xmerl-2.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/et-1.7.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/sasl-4.2.2/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/ssl-11.2.2/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/common_test-1.27.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/compiler-8.5.2/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/erl_interface-5.5.2/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/jinterface-1.14.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/ftp-1.2.3/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/dialyzer-5.2.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/reltool-1.0.1/ebin iex -S mix -name debuggeda68c5c05-5494-44b7-9ad8-8364f3aeb56a@127.0.0.1 -setcookie a68c5c05-5494-44b7-9ad8-8364f3aeb56a -eval application:ensure_all_started(elixir) -eval 'Elixir.Code':require_file(<<\"/tmp/intellij_elixir10/debugger/lib/intellij_elixir/debugger/server.ex\">>) -eval 'Elixir.Code':require_file(<<\"/tmp/intellij_elixir10/debugger/lib/intellij_elixir/debugged.ex\">>) -eval 'Elixir.Code':require_file(<<\"/tmp/intellij_elixir10/debugger/lib/mix/tasks/intellij_elixir/debug.ex\">>) -pa /home/nico/.asdf/installs/elixir/1.17.3/lib/elixir/ebin -pa /home/nico/.asdf/installs/elixir/1.17.3/lib/ex_unit/ebin -pa /home/nico/.asdf/installs/elixir/1.17.3/lib/iex/ebin -pa /home/nico/.asdf/installs/elixir/1.17.3/lib/mix/ebin -pa /home/nico/.asdf/installs/elixir/1.17.3/lib/logger/ebin -pa /home/nico/.asdf/installs/elixir/1.17.3/lib/eex/ebin -noshell -s elixir start_cli -elixir ansi_enabled true -extra /home/nico/.asdf/installs/elixir/1.17.3/bin/mix do intellij_elixir.debug, phx.server
Error! Failed to load module 'mix' because it cannot be found.
Make sure that the module name is correct and that its .beam file
is in the code path.

Runtime terminating during boot ({undef,[{init,start_it,1,[]},{init,start_em,1,[]},{init,do_boot,3,[]}]})

Crash dump is being written to: erl_crash.dump...done
  • Unable to connect when going to http://localhost:4000/

Followed this Medium article or this post to create the debug configuration

If I run the configuration without erl arguments iex -S mix, this is the result:

/home/nico/.asdf/installs/erlang/27.1/bin/erl -pa /home/nico/.asdf/installs/erlang/27.1/lib/observer-2.16/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/tftp-1.2.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/kernel-10.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/megaco-4.6/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/wx-2.4.3/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/parsetools-2.6/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/os_mon-2.10/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/ssh-5.2.2/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/mnesia-4.23.2/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/tools-4.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/stdlib-6.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/inets-9.3/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/snmp-5.17/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/diameter-2.4.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/edoc-1.3.2/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/asn1-5.3.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/odbc-2.15/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/syntax_tools-3.2.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/crypto-5.5.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/public_key-1.16.2/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/eldap-1.2.13/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/runtime_tools-2.1.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/eunit-2.9.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/debugger-5.4/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/erts-15.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/xmerl-2.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/et-1.7.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/sasl-4.2.2/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/ssl-11.2.2/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/common_test-1.27.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/compiler-8.5.2/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/erl_interface-5.5.2/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/jinterface-1.14.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/ftp-1.2.3/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/dialyzer-5.2.1/ebin -pa /home/nico/.asdf/installs/erlang/27.1/lib/reltool-1.0.1/ebin -name debuggede1784c9d-1d27-42b1-b06d-dbbdabade8eb@127.0.0.1 -setcookie e1784c9d-1d27-42b1-b06d-dbbdabade8eb -eval application:ensure_all_started(elixir) -eval 'Elixir.Code':require_file(<<\"/tmp/intellij_elixir3/debugger/lib/intellij_elixir/debugger/server.ex\">>) -eval 'Elixir.Code':require_file(<<\"/tmp/intellij_elixir3/debugger/lib/intellij_elixir/debugged.ex\">>) -eval 'Elixir.Code':require_file(<<\"/tmp/intellij_elixir3/debugger/lib/mix/tasks/intellij_elixir/debug.ex\">>) -pa /home/nico/.asdf/installs/elixir/1.17.3/lib/elixir/ebin -pa /home/nico/.asdf/installs/elixir/1.17.3/lib/ex_unit/ebin -pa /home/nico/.asdf/installs/elixir/1.17.3/lib/iex/ebin -pa /home/nico/.asdf/installs/elixir/1.17.3/lib/mix/ebin -pa /home/nico/.asdf/installs/elixir/1.17.3/lib/logger/ebin -pa /home/nico/.asdf/installs/elixir/1.17.3/lib/eex/ebin -noshell -s elixir start_cli -elixir ansi_enabled true -extra /home/nico/.asdf/installs/elixir/1.17.3/bin/mix do intellij_elixir.debug, phx.server
     warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
     β”‚
 111 β”‚       |> Stream.reject(&(&1 == '.'))
     β”‚                                ~
     β”‚
     └─ /tmp/intellij_elixir3/debugger/lib/intellij_elixir/debugger/server.ex:111:32

Waiting for debugger to attach...

11:57:02.776 [error] GenServer IntelliJElixir.Debugger.Server terminating
** (UndefinedFunctionError) function :int.interpreted/0 is undefined (module :int is not available)
    :int.interpreted()
    /tmp/intellij_elixir3/debugger/lib/intellij_elixir/debugger/server.ex:166: IntelliJElixir.Debugger.Server.handle_call/3
    (stdlib 6.1) gen_server.erl:2381: :gen_server.try_handle_call/4
    (stdlib 6.1) gen_server.erl:2410: :gen_server.handle_msg/6
    (stdlib 6.1) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
Last message (from #PID<9302.4.0>): {:set_breakpoint, HelloElixirWeb.PageController, 7}
State: %IntelliJElixir.Debugger.Server{attached: nil, evaluate_meta_pid_to_froms: %{}}
Client #PID<9302.4.0> is remote on node :"debuggere1784c9d-1d27-42b1-b06d-dbbdabade8eb@127.0.0.1"

The break point is placed under the render in this module:

defmodule HelloElixirWeb.PageController do
  use HelloElixirWeb, :controller

  def home(conn, _params) do
    # The home page is often custom made,
    # so skip the default app layout.
    render(conn, :home, layout: false)
  end
end

Any guidance will be much appreciated.

Thank you!

2 Likes

Tagging you @KronicDeth, in case you faced this before :pray: