fahani

fahani

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!

First Post!

fahani

fahani

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

Where Next?

Popular in Questions Top

albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New
beno
I will often find my self writing things similar to: case some_value do nil -&gt; something() "" -&gt; something() _ -&gt; somethi...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

Other popular topics Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52341 488
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New

We're in Beta

About us Mission Statement