This is a bug I recently encountered with Karma and the Karma Sauce Launcher plugin. It plagued me for a week, finally I worked out the issue and I had to share the solution incase anyone else encountered the same thing.
The issue I encountered was none of the SauceLabs tests would run. It would say it was spinning up a remote browser on SauceLabs, but no proxy was being created and eventually everything would just time out.
Looking in my network activity suggested requests were not being made, almost as if something else was stopping them. I had debug mode on and there were no errors, just nothing.
Interestingly, in the console I would see POST requests being made to /session
with the appropriate options as per SauceLabs’ documentation on making proxy requests. These POST requests were not actually being made, no links to view the remote test and nothing in the SauceLabs console either.
If you don’t want to read what I tried and just want the solution, skip to the section below titled “The solution” for how I fixed it.
Inside of my karma.conf.js
file I had the following in my SauceLabs object:
sauceLabs: {
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER,
username: process.env.SAUCE_USERNAME,
accessKey: process.env.SAUCE_ACCESS_KEY,
startConnect: false,
connectOptions: {
port: 5757,
logile: "sauce_connect.log"
}
},
A pretty standard looking SauceLabs configuration object. Also, more interestingly is this worked up until recently and then seemingly stopped working across multiple repos on a client project I was working on. Truly a perplexing situation.
I tried everything (and I mean everything):
- Downgrading Node to different versions (current to stable and every incremental version)
- Trying out different versions of Karma and the Karma Sauce Launcher plugin
- Using different Karma plugins as part of my build process; karma-typescript, karma-requirejs, karma-browserify and karma-webpack
- Attempting to start a Karma server via a Gulpfile.js
- Tweaking the Travis CI configuration
None of this worked. I was beginning to panic, almost ready to throw in the towel and started looking into Crossbrowsertesting as an alternative instead of SauceLabs.
Then, by chance I accidentally solved the issue.
The solution
Remove the connectOptions
section from your SauceLabs object:
connectOptions: {
port: 5757,
logile: "sauce_connect.log"
}
I didn’t actually bother testing it, but I suspect the port is wrong. I couldn’t find anything that suggest anything had changed, but I did find a few references to port 4445
that SauceLabs listens on. Perhaps this is the new port you specify and 5757
is deprecated.
Or maybe, the issue was the connectOptions
were overriding some important defaults? Who knows, all I know is that it fixed the issue and if I saved you a week or more worth of debugging then I am happy.
Wow i can’t thank you enough, i have been experiencing same issue, the time out felt like hell, thanks for posting this…
You saved my week.