Remote connection to elixir IEx through ssh port forwarding fails only for IEx (not for erl)

Hello! I am trying to build a script to connect to a remote machine through ssh port forwarding, then run IEx using remsh and that port from localhost.
What is very strange is that I can successfully connect (and confirm that by loading all my modules) through erl and even run observer seeing everything that’s going on the other server, but not through iex, using the same parameters, this is bugging my head, can someone help?

ssh command:

ssh -N -L $port:localhost:$port -L 4369:localhost:4369 my_app@$machine &

in this case port is the internal epmd port, example:

epmd: up and running on port 4369 with data:
name my_app at port 31747

port = 31747

and machine is just the hostname, something like:

commands that work:

erl -name debug@ -setcookie $secret_cookie -hidden -run observer
erl -name "debug@" -setcookie "$secret_cookie" -remsh "my_app@"


Erlang/OTP 22 [erts-10.5.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]

Eshell V10.1.1  (abort with ^G)

command that doesn’t work:

iex --name "debug@" --cookie "$secret_cookie" --remsh "my_app@"

Error message:
Could not contact remote node my_app@, reason: :nodedown. Aborting...

1 Like