Are there any way to debug phoenix app with Intellij IDEA

I’m using Intellij IDE with Elixir plugin.
However I have no idea to configure the settings for debug phoenix app.

Or VSCode also welcome to me for debuggings.

Do you know any way to configure?

What issue where you having with debugging using intellij? It was documented last I checked, though I’m typing this on my phone currently so difficult for me to check. :sweat_smile:

Vscode can’t though.

I mostly use IEx.pry though. :slightly_smiling_face:

I’m trying to use IEx.pry. However it seems not to work.

I put require IEx and IEx.pry in controller. and run iex -S mix phx.server. Nothing has happened.

Try replication it with a simple script first perhaps?

I use RubyMine but the steps should be similar. You have to configure a Run Configuration for mix phx.server and then click in the margin to set a break point in the source code and finally click the debug icon from the menu bar to run the phx.server task in debug mode. You don’t have to do anything in settings, assuming you’ve defined the Elixir and Erlang SDK’s (which also gets the syntax highlighting etc.). The instructions in the plugin’s readme are pretty easy to follow.

From Run menu > Edit Configurations click + and set this up

Set your break point by clicking in the margin in the source file

Select the Run Configuration in the menu bar and then click the debug symbol to the right of the play arrow to start the debugger.
Screen Shot 2019-12-25 at 6.47.30 PM

It works decently for running code, however it doesn’t always work in tests for me, so I usually wind up inspecting via stdout. Most likely only works in .ex files and not in .exs files like tests, but generally, it works well. Using IEx.pry should be completely independent of the IDE, so no idea why that would not work for you unless you haven’t saved the buffer in the editor or something…hard to say.

FWIW, the test runner in JetBrains IDEs is fantastic and allows you to quickly loop over individual tests or groups of tests when the source changes, with a configurable delay (kind of like Guard).

1 Like

I recall a co-worker of mine had success using this I’m not sure what else would be involved for phoenix in particular, besides run configurations for the server?


I had same settings, however I had following error.
When I start debugging, server does not run.

If I try to start normal server, it runs without problem.

init terminating in do_boot ({,[{Elixir.Code,find_file,2,[{_},{_}]},{Elixir.Code,require_file,2,[{_},{_}]},{erl_eval,do_apply,6,[{_},{_}]},{init,start_it,1,[{_},{_}]},{init,start_em,1,[{_},{_}]},{init

Crash dump is being written to: erl_crash.dump...{"init terminating in do_boot",{#{'__exception__'=>true,'__struct__'=>'Elixir.Code.LoadError',file=><<99,58,47,87,111,114,107,115,47,70,97,108,99,111,110,115,47,85,115,101,114,115,104,105,114,111,121,117,107,105,46,116,97,106,105,109,97,65,112,112,68,97,116,97,76,111,99,97,108,84,101,109,112,105,110,116,101,108,108,105,106,95,101,108,105,120,105,114,50,127,101,98,117,103,103,101,114,108,105,98,105,110,116,101,108,108,105,106,95,101,108,105,120,105,114,127,101,98,117,103,103,101,114,32,101,114,118,101,114,46,101,120>>,message=><<99,111,117,108,100,32,110,111,116,32,108,111,97,100,32,99,58,47,87,111,114,107,115,47,70,97,108,99,111,110,115,47,85,115,101,114,115,104,105,114,111,121,117,107,105,46,116,97,106,105,109,97,65,112,112,68,97,116,97,76,111,99,97,108,84,101,109,112,105,110,116,101,108,108,105,106,95,101,108,105,120,105,114,50,127,101,98,117,103,103,101,114,108,105,98,105,110,116,101,108,108,105,106,95,101,108,105,120,105,114,127,101,98,117,103,103,101,114,32,101,114,118,101,114,46,101,120>>},[{'Elixir.Code',find_file,2,[{file,"lib/code.ex"},{line,1193}]},{'Elixir.Code',require_file,2,[{file,"lib/code.ex"},{line,806}]},{erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,680}]},{init,start_it,1,[{file,"init.erl"},{line,1129}]},{init,start_em,1,[{file,"init.erl"},{line,1115}]},{init,do_boot,3,[{file,"init.erl"},{line,823}]}]}}


I found all project I made ( have same errors.
I thought previously I could debug same settings.
Currently my environment is following one.

Erlang : V10.3
Elixir : 1.9.4
Phoenix : v1.4.11

Seems the IDE is not recognizing your Elixir installation or Erl. There’s an issue in the plug-in GutHub repo that defines the steps to fix it. I’m travelling right now so I can’t look it up for you.

I found windows does not work, but mac does.

Ahh, ok. I did see something about the path delimiters being wrong in Windows. I use primary OSX, sometimes Linux, so never encountered it myself.