Extend the example from README.md to use localIdentifier:
var browserstack = require('browserstack-local');
// creates an instance of Local
var bs_local = new browserstack.Local();
// replace <browserstack-accesskey> with your key. You can also set an environment variable - "BROWSERSTACK_ACCESS_KEY".
var bs_local_args = {
'key': '<browserstack-accesskey>', // actual key here of course
'localIdentifier': 'foo'
};
// starts the Local instance with the required arguments
bs_local.start(bs_local_args, function() {
console.log("Started BrowserStackLocal");
console.log(bs_local.isRunning());
});
// check if BrowserStack local instance is running
console.log(bs_local.isRunning());
// stop the Local instance
bs_local.stop(function() {
console.log("Stopped BrowserStackLocal");
});
OS: Mac OSX 10.11.5
Node Version: Tried 4.3.2 and 6.2.2
Expected Result
Same as when only specifiying the access-key (which works)
Tunnel is established
bs_local.isRunning() outputs true
logFile says You can now access your local server(s) in our remote browser.
Actual Result
Tunnel is not established
bs_local.isRunning outputs undefined
logFile says *** Error: Could not connect to -localIdentifier foo!
Same thing happens when you specify proxy-settings:
var browserstack = require('browserstack-local');
// creates an instance of Local
var bs_local = new browserstack.Local();
// replace <browserstack-accesskey> with your key. You can also set an environment variable - "BROWSERSTACK_ACCESS_KEY".
var bs_local_args = {
'key': '<access-key>', // actual key here of course
'proxyHost': 'proxy.example.de', // actual proxy host here instead
'proxyPort': '8080',
};
// starts the Local instance with the required arguments
bs_local.start(bs_local_args, function() {
console.log("Started BrowserStackLocal");
console.log(bs_local.isRunning());
});
// check if BrowserStack local instance is running
console.log(bs_local.isRunning());
// stop the Local instance
bs_local.stop(function() {
console.log("Stopped BrowserStackLocal");
});
Result is same as above, but the log message now is: *** Error: Could not connect to -proxyHost proxy.example.de!
What I tried
I traced the error back to the https://github.com/browserstack/browserstack-local-nodejs/blob/master/lib/Local.js#L31 and inspected that.binaryPath and that.getBinaryArgs(). When I just concatenate the binaryPath and the args-array as node should execute them (eg. /Users/foo/.browserstack/BrowserStackLocal -d start -logFile /Users/foo/browserstack-local-tryout/local.log <real access key> -proxyHost proxy.example.de -proxyPort 8080) everything works as expected.
The problem seems to occur with all options that are made up out of a cli-flag that requires options such as localIdentifier, proxyHost and proxyPort. I also tried to execute childProcess.execFile like this childProcess.execFile(that.binaryPath, [ '-d', 'start', '-logFile' './browserstack-local-tryout/local.log', '<browserstack-accesskey>', '-localIdentifier', 'foo' ]) without success
Steps to reproduce
Extend the example from
README.md
to uselocalIdentifier
:OS: Mac OSX 10.11.5 Node Version: Tried
4.3.2
and6.2.2
Expected Result
Same as when only specifiying the access-key (which works)
bs_local.isRunning()
outputstrue
You can now access your local server(s) in our remote browser.
Actual Result
bs_local.isRunning
outputsundefined
*** Error: Could not connect to -localIdentifier foo!
Same thing happens when you specify proxy-settings:
Result is same as above, but the log message now is:
*** Error: Could not connect to -proxyHost proxy.example.de!
What I tried
that.binaryPath
andthat.getBinaryArgs()
. When I just concatenate the binaryPath and the args-array as node should execute them (eg./Users/foo/.browserstack/BrowserStackLocal -d start -logFile /Users/foo/browserstack-local-tryout/local.log <real access key> -proxyHost proxy.example.de -proxyPort 8080
) everything works as expected.localIdentifier
,proxyHost
andproxyPort
. I also tried to executechildProcess.execFile
like thischildProcess.execFile(that.binaryPath, [ '-d', 'start', '-logFile' './browserstack-local-tryout/local.log', '<browserstack-accesskey>', '-localIdentifier', 'foo' ])
without success