bermi / sauce-connect-launcher

Downloads and launches an instance of Sauce Connect Selenium Proxy https://wiki.saucelabs.com/display/DOCS/Sauce+Connect+Proxy
72 stars 68 forks source link

Unable to connect to Saucelabs - "Sauce Connect could not establish a connection" #157

Open apgemini opened 4 years ago

apgemini commented 4 years ago

Hi There,

Seeing this error message "Sauce Connect could not establish a connection" while trying to run TestCafe tests on Saucelabs. I could be missing something at my end but want to get help as this module is throwing the error.

I have also reached out to Saucelabs support. Sauce credentials are valid and i am printing them out as shown below via console.log(). [Please ignore other redundant console statements]

Using sauce-connect-launcher@1.2.2 version.

$ testcafe "saucelabs:Chrome@83.0:macOS 10.14" ./test/functional/tests/items/test.js
Using locally installed version of TestCafe.
The "src", "browsers" options from the configuration file will be ignored.
username --->> xxxxxxxxxx
accessKey --->> xxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxx
OPTION 0
LOGGER --->> function () {}
OPTION END
username --->> xxxxxxxxxx
accessKey --->> xxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxx
OPTION 0
LOGGER --->> function () {}
OPTION END
username --->> xxxxxxxxxx
accessKey --->> xxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxx
OPTION 0
LOGGER --->> function () {}
OPTION END
username --->> xxxxxxxxxx
accessKey --->> xxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxx
OPTION 0
LOGGER --->> function () {}
OPTION END
ERROR Error: 31 May 15:03:23 - Sauce Connect could not establish a connection.
    at handleError (/Users/atestuser/global_repo/testpp/apptest/node_modules/sauce-connect-launcher/lib/sauce-connect-launcher.js:410:17)
    at /Users/atestuser/global_repo/testpp/apptest/node_modules/sauce-connect-launcher/lib/sauce-connect-launcher.js:517:11
    at /Users/atestuser/global_repo/testpp/apptest/node_modules/lodash/lodash.js:4905:15
    at baseForOwn (/Users/atestuser/global_repo/testpp/apptest/node_modules/lodash/lodash.js:2990:24)
    at /Users/atestuser/global_repo/testpp/apptest/node_modules/lodash/lodash.js:4874:18
    at Function.forEach (/Users/atestuser/global_repo/testpp/apptest/node_modules/lodash/lodash.js:9342:14)
    at /Users/atestuser/global_repo/testpp/apptest/node_modules/sauce-connect-launcher/lib/sauce-connect-launcher.js:515:9
    at arrayEach (/Users/atestuser/global_repo/testpp/apptest/node_modules/lodash/lodash.js:516:11)
    at Function.forEach (/Users/atestuser/global_repo/testpp/apptest/node_modules/lodash/lodash.js:9342:14)
    at Socket.<anonymous> (/Users/atestuser/global_repo/testpp/apptest/node_modules/sauce-connect-launcher/lib/sauce-connect-launcher.js:503:7)

Appreciate any help.

redbugz commented 4 years ago

I had a similar error. I added some debug messages and it might be shell escaping? I am using zsh, and when I take the command line that is generated from the logs and run it manually on zsh I get an error because of escaping. When I use bash, it seems to work.

Command line arguments: /path/to/app/node_modules/sauce-connect-launcher/sc/sc-4.6.2-linux/bin/sc -u **** -k **** --tunnel-identifier *** --direct-domains *.google.com,*.gstatic.com,*.googleapis.com --readyfile /tmp/sc-launcher-readyfile -x https://saucelabs.com/rest/v1 

Particularly the unescaped direct-domains, in zsh those cause an error because they don't match a file