Description
Our CI build started to fail due to browserstack-local
throwing these errors:
Connecting BrowserStack local..
undefined:1
Tue Sep 01 2020 14:26:45 GMT+0000 (UTC) -- Container runtime environment detected
^
SyntaxError: Unexpected token T in JSON at position 0
at JSON.parse (<anonymous>)
at /root/<foo>/node_modules/browserstack-local/lib/Local.js:59:23
at ChildProcess.exithandler (child_process.js:295:7)
at ChildProcess.emit (events.js:196:13)
at maybeClose (internal/child_process.js:1011:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:268:5)
As these randomly started, I suspect the BrowserStackLocal
binary was updated with a broken version, as it doesn't seem to be pinned to a particular one. Manually starting the binary shows log messages in stdout
, which probably shouldn't be there since browserstack-local
expect valid JSON:
bash-4.4# /root/.browserstack/BrowserStackLocal --version 2>/dev/null
Tue Sep 01 2020 14:31:19 GMT+0000 (UTC) -- Container runtime environment detected
Tue Sep 01 2020 14:31:19 GMT+0000 (UTC) -- Attaching services to public interface
BrowserStack Local version 8.1
I'm running browserstack-local-nodejs
v1.4.5 as v1.4.6 is broken as pointed out in 7e73b1f#r41945904, but manually patching v1.4.6 still shows the same issue.
This happens on Alpine Linux within a Docker container, hence the "Container runtime environment detected". The issue seems limited to container environments as running the v8.1 outside a container does not show the logs, and doesn't break browserstack-local
.
In the future it would be great if the version of the BrowserStack binary could be pinned to a particular browserstack-local
one, instead of the last version of the binary being randomly fetched as it is the case currently, causing CI builds to unexpectedly break.