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: qa.company_name.com

commands that work:

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

execution:

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)
(my_app@127.0.0.1)1>

command that doesn’t work:

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

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

1 Like