nickjs icon indicating copy to clipboard operation
nickjs copied to clipboard

Heroku: Error: connect ECONNREFUSED 127.0.0.1:9222

Open wbelk opened this issue 5 years ago • 17 comments

could not connect to chrome debugger after 24 tries (10s): Error: connect ECONNREFUSED 127.0.0.1:9222

this just popped up for some reason on heroku, i have legacy dynos running the same code and working perfectly. tried to add a fresh dyno and getting this error for the first time

settings are: Stack: heroku-16 node: 8.9.0 npm: 5.5.1

wbelk avatar Sep 17 '18 19:09 wbelk

@wbelk possibly, it is similar to this? Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:9222

msaus avatar Sep 19 '18 06:09 msaus

Well...when I deploy to production environment I am getting the same error. There are no google-chrome instances running and so I have no idea what to do next.

node: v8.12.0 npm: 6.4.1 google-chrome: 69.0.3497.100

msaus avatar Oct 03 '18 02:10 msaus

I figure this out, but, this is really weird for me.

Before, start taking about how I figure this out, nodejs and pm2 are installed globally. The reason why I have pm2 is that I used to have nodejs based API with nickjs.

■Steps to figure this out.

① Execute my old nodejs based API with 1 process. ② Create HTTP request to API from 1. Note: nickjs should be used by the API ③The process from ① should be kept all the time in order to run nickjs, otherwise, I get the same error.

I do not know why I have to keep running my old API. Also, I tried restaill nodejs, pm2 and Google Chrome. But, this dose not work.

Of course, when I get this error, chrome is not up and running.

If you have any idea, please let me know.

msaus avatar Jan 04 '19 03:01 msaus

If I understand correctly, your NickJS script, for some reason, cannot start the chrome subprocess in your environment. But in older Heroku environments, it does work like it should.

Can you please add debug: true to your NickJS' constructor options? And report back with what it shows

In containerized/dockerized environments, starting chrome can be a pain. A simple google search shows many people having difficulties. For example chrome must be started with --no-sandbox (which NickJS does), the container should have a big shm size, etc... Maybe the newer Heroku has stricter container settings?

paps avatar Jan 09 '19 13:01 paps

I have the same error on Ubuntu 16.04, I tried node v8 and v11.6, chromium, chrome 70, 71,72,73(unstable).. I specified export CHROME_PATH="/usr/bin/google-chrome"; , also tried /opt/google/chrome/...

Edit: I solved it by starting chrome 71 like this: google-chrome --remote-debugging-port=9222 --no-first-run, --no-default-browser-check, and --user-data-dir

elhenro avatar Jan 09 '19 21:01 elhenro

@elhenro are you starting chrome by hand alongside NickJS?

paps avatar Jan 09 '19 23:01 paps

affirmative, the only way for me right now is to quit chrome completely and then start it with those options

elhenro avatar Jan 10 '19 08:01 elhenro

Can you please add debug: true to your NickJS' constructor options? And report back with what it shows? (do not start chrome by hand, I just want to see what happens on NickJS' side when it fails)

paps avatar Jan 10 '19 13:01 paps

Sorry for late reply. Currently, my app is running on production and I can not stop it right now. So, when I have a chance for it, I will add debug: ture to see what happen to Nickjs. Regards.

msaus avatar Mar 20 '19 01:03 msaus

I'm having the same issue on windows ubuntu wsl here's the output of the debug CHROME STDOUT: Starting ChromeDriver 74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}) on port 9515 Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code. ERROR: could not connect to chrome debugger after 8 tries (10s): Error: connect ECONNREFUSED 127.0.0.1:9222

bbathel12 avatar Mar 29 '19 19:03 bbathel12

@bbathel12 I guess you have to give the permission to Windows.

msaus avatar Mar 29 '19 21:03 msaus

@paps Ubuntu 16.04.5 LTS

I got following errors.

CHROME STDERR: [0412/123550.772631:ERROR:gpu_process_transport_factory.cc(980)] Lost UI shared context. CHROME STDERR: DevTools listening on ws://127.0.0.1:9222/devtools/browser/935baa40-9193-42d8-8709-06b781803ec7 Something went wrong: could not connect to chrome debugger after 24 tries (10s): Error: connect ECONNREFUSED ::1:9222

msaus avatar Apr 12 '19 03:04 msaus

I am still getting the same error and so I have to do the follow the steps that I mentioned. By the way, I am getting error on Ubuntu machine and I do not know what to do next. If you can help me out, I will give you more details.

msaus avatar Apr 12 '19 05:04 msaus

It might be because it's a too recent version of Chrome. Can you try with Chrome 65? I know it's old but it might do the trick

paps avatar Apr 15 '19 14:04 paps

@paps when I have a chance for that, I will switch to chrome 65. Can it downloaded from here? https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/chromium-browser/65.0.3325.181-0ubuntu0.16.04.1/chromium-browser_65.0.3325.181.orig.tar.xz

msaus avatar Apr 16 '19 06:04 msaus

Then, I guess you had better to write what chrome version supported, otherwise, people get stacked like me.

msaus avatar Apr 16 '19 06:04 msaus

I'll update the readme if you can confirm that it's working with an older version :)

paps avatar Apr 16 '19 13:04 paps