Skip to content

browserstack-local: bs_Local.isRunning() returns undefined #80

Open

Description

@EDMB-QA

Issue:
bs_Local.isRunning() is always returns undefined.

Details

My Code:
const browserstackLocal = require('browserstack-local');
const bs_Local = new browserstackLocal.Local();

/* Function to establish local connection */
async newBrowserLocal(browserStackConfig) {
const bsLocalArgs = { key: browserStackConfig.bsKey, forcelocal: 'true' };
await bs_Local.start(bsLocalArgs, async function () {
await console.log('Started BrowserStackLocal');
});
}
await console.log(bs_Local.isRunning());

output:
Started BrowserStackLocal
undefined

Activity

  1. o-hook commented on Sep 6, 2019

    @o-hook

    Exactly the same error happens to me with the exact same setup aka async function calls. Any suggestion how to solve this? Running the latest version of browserstack-local.

  2. o-hook commented on Sep 6, 2019

    @o-hook

    Now it works with following function call:

        const bs_local = new browserstack.Local();
        return new Promise((resolve, reject)=> {
          const config: any = { 'key': 'KEY, 'force': 'true', 'localIdentifier': 'BSTest'};
          bs_local.start(config, (error)=> {
            console.log('Local started');
            if (error) {
              reject(error);
            }
            resolve(bs_local);
          });
        });
    

    Hope this helps!

  3. mrcnski commented on Jun 22, 2021

    @mrcnski

    Thank you @o-hook. This should be fixed along with the related issue #118.

  4. SCG82 commented on Oct 16, 2022

    @SCG82

    Try

    bs_Local.startSync(bsLocalArgs);
    console.log('Started BrowserStackLocal', bs_Local.isRunning());
  5. egarc12 commented on Feb 9, 2023

    @egarc12

    +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions