9

I'm receiving ECONNREFUSED for heroku run any_command_here. Heroku login is successful. Other heroku commands are successful as well (apps,releases, sharing). App is running. I can even access heroku logs. Ubuntu version is 14.04.

Zh Kostev
  • 588
  • 3
  • 17
  • I think your question _might_ be better suited for ServerFault – Preview Jan 16 '16 at 10:55
  • @Aperçu. Unfortunately there is no message to help. It just prints ▸ ECONNREFUSED: connect ECONNREFUSED +server_ip:5000 and that all. I can see that I've been added to this app. My ssh key is added to heroku account. I can see logs for this app, but I can't evaluate run command =( I removed ubuntu heroku toolbelt and reinstall it as Standalone, but this didn't help. – Zh Kostev Jan 18 '16 at 06:12
  • 1
    Is it possible you have a firewall or proxy server blocking a connection? – James Ward Jan 18 '16 at 23:42
  • @JamesWard Can you be a little bit more specific? I've checked this sudo ufw status it returns Status: inactive – Zh Kostev Jan 19 '16 at 07:31
  • You can see that the `heroku-run` plugin in the CLI is probably attaching to a non-standard port: https://github.com/heroku/heroku-run/blob/master/commands/run.js#L103 You probably have a firewall or something between you and that server that is blocking access. You could file an issue on that project. – James Ward Jan 19 '16 at 15:46
  • BTW: You can see an example URL in the Heroku Platform API docs: https://devcenter.heroku.com/articles/platform-api-reference#dyno – James Ward Jan 19 '16 at 15:52
  • Just wondering, does "server_ip" (as in "+server_ip:5000") begin with "192.168"? If so, then it's probably an external firewall (between your computer and the internet; aka inside your network). – Coder-256 Jan 22 '16 at 00:19
  • 1
    @Coder256 . Thanks for pointing thing about server ip. It was external firewall. Not on my local machine, but in office network. You can write answer and I will accept it. – Zh Kostev Jan 22 '16 at 10:18
  • Did you find any solution for running commands (without `:detach`) even when behind a firewall? – Kamafeather Jul 25 '19 at 12:24

2 Answers2

13

Try running

heroku run:detached your command here

and it will fly, if the issue was the firewall.

qknowswhat
  • 331
  • 3
  • 3
  • 1
    Allows commands to execute, but `stdout` of these commands won't be attached to your terminal, so you can't open an interactive shell with `heroku run bash`. – weibeld Jan 31 '18 at 19:18
  • https://devcenter.heroku.com/articles/using-the-cli#using-an-http-proxy – Vladimir Vukanac Apr 18 '20 at 22:47
3

There may be an external firewall - a firewall between your computer and the internet (inside your network). Chances are that if the server_ip begins with 192.168, then that is the case.

Coder-256
  • 5,212
  • 2
  • 23
  • 51
  • 1
    how can i solve this problem? how can i disable such firewall? my address is 127.0.0.1 – ocram Jul 22 '16 at 17:14
  • You can't disable the firewall, but see [this answer](https://stackoverflow.com/a/44694960/4747193). – weibeld Jan 31 '18 at 19:19