Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running tests on Jenkins: TypeError: Cannot read property 'message' of undefined #27

Closed
Lukas-Kullmann opened this issue Apr 16, 2018 · 8 comments
Labels

Comments

@Lukas-Kullmann
Copy link
Contributor

When running our tests on our Jenkins, I get an error

/var/lib/****/node_modules/browserstack-local/lib/Local.js:61
          callback(new LocalError(data['message']['message']));
                                                 ^

TypeError: Cannot read property 'message' of undefined
    at /var/lib/****/node_modules/browserstack-local/lib/Local.js:61:50
    at ChildProcess.exithandler (child_process.js:267:7)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

The issue here is, that the response of the childProcess.execFile in the browserstack-local package is empty. error is null and stdout and stderr are both empty strings. That's why data is an empty object.

I tried investigating what is going on, but I did not find a solution.

The binaryArgs for our run were:

[ '--daemon',
  'start',
  '--log-file',
  '/dev/null',
  '--key',
  '****',
  '--local-identifier',
  1523874577640,
  '--enable-logging-for-api' ]

If I try to provide a logfile, it will be empty.

We do not use a proxy.

If I run the tests locally on my machine (with the same credentials), I do not get an error. The tests start normally.

Did anybody ever have a similar issue or does anybody have an idea what might be going on? Any help would be appreciated!

@AndreyBelym
Copy link
Contributor

Hi @Lukas-Kullmann! Looks like it's a problem with browserstack-local-nodejs package. I would recommend you to create an issue there.

For debugging purposes, I suggest you to check exit code of the Browserstack Local process, if it's not zero, likely it's a problem with permissions or something, check if binary at $HOME/.browserstack/BrowserStackLocal has executable flag. If it won't help, try to connect to your Jenkins slave after all packages have been installed, and invoke BrowserStackLocal binary manually.

@Lukas-Kullmann
Copy link
Contributor Author

Hi @AndreyBelym! Thanks for the response!
We actually could nail the proplem down. We actually need to set the parallel-runs flag to some value to be able to start the server. Currently this is not possible with this provider.

I will fix it and open a PR. :)

@AndreyBelym
Copy link
Contributor

AndreyBelym commented Apr 16, 2018

That's interesting. Sorry for casting you @pulkitsharma07, but could you please clarify if it is required to use this flag when running multiple builds, or I should contact the Browserstack Support for that? It's my shame that I've missed that flag, but everything was working fine for us before. The flag affects a number of BrowserStackLocal forked process, and judging by different flag's values, BrowserStackLocal might spawn up to spawns ($PARALLEL_RUNS - 1) / 10, handicapped with 9 processes in total. So looks like the default value for --parallel-runs can be any number starting from 31 and ending with 40.

@AndreyBelym
Copy link
Contributor

@Lukas-Kullmann I've published testcafe-browser-provider-browserstack@1.3.0 with the fix, thank you so much! 🎉

@Lukas-Kullmann
Copy link
Contributor Author

I thank you so much, that was super fast - lightning speed! :-)

@shermaneric
Copy link

Hey there. I'm sorry to bump this old thread. I'm running into a similar issue here. Not sure if I'm doing something grossly wrong. Thanks!

@AndreyBelym
Copy link
Contributor

Hi @shermaneric, have you tried to set the BROWSERSTACK_PARALLEL_RUNS environment variable?

@shermaneric
Copy link

Indeed. Here's the SO post. I'm attempting to run it out of the node alpine-7 container. Probably something limiting me there perhaps?

Thanks for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants