Skip to content

browserstack-local sometimes breaks due to Incorrect JSON in stdout #127

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

Open
elukoyanov opened this issue Mar 16, 2022 · 0 comments · May be fixed by #136
Open

browserstack-local sometimes breaks due to Incorrect JSON in stdout #127

elukoyanov opened this issue Mar 16, 2022 · 0 comments · May be fixed by #136

Comments

@elukoyanov
Copy link

Expected Behavior

browserstack-local starts and works fine

Actual Behavior

browserstack-local starts and fails with next error

SyntaxError: Unexpected token { in JSON at position 66
    at JSON.parse (<anonymous>)
    at /<project path>/node_modules/browserstack-local/lib/Local.js:59:23
    at ChildProcess.exithandler (node:child_process:388:7)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1064:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
error Command failed with exit code 1.

Steps to Reproduce the Problem

it's flaky, but often reproduces

  1. start connection to BrowserStack before tests

browserstack local arguments

    local: true,
    localIdentifier: "" // generated id:  `${<project name>}_${os.userInfo().username}_${Math.round(Math.random() * 1e6)}` as string,

    networkLogs: true,
    consoleLogs: "errors",
    resolution: "1280x1024",
    seleniumVersion: "4.0.0-alpha-6", // also reproduced with "4.1.2", "3.141.59"
    idleTimeout: 300,

    os: "Windows",
    osVersion: "10",

    projectName: "" // project name as string,
    sessionName: "" // name as string,
    buildName: "" // name as string,

Platform details

  1. browserstack-local-nodejs version: 1.4.8, also reproduced on 1.4.9
  2. node version: 16.13.0, also reproduced on 14.3.0, 14.18.0
  3. os type and version: ubuntu/macos

Details

I made fork with logging of reponse
https://github.com/elukoyanov/browserstack-local/blob/master/lib/Local.js#L61
and I see next stdout:

{"state":"connected","pid":323,"message":{"message":"Connected"}}
{"state":"connected","pid":323,"message":{"message":"Connected"}}
Thu Mar 10 2022 15:59:47 GMT+0000 (Coordinated Universal Time) -- Received runtime exception: Error [ERR_IPC_DISCONNECTED]: IPC channel is already disconnected
Thu Mar 10 2022 15:59:47 GMT+0000 (Coordinated Universal Time) -- Exiting.

As I see - there are duplicated JSON and two strings with error.

It breaks JSON.parse.

As I see, it's more server error, than package. But maybe not

@SCG82 SCG82 linked a pull request Oct 16, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant