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

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

Open
EDMB-QA opened this issue Aug 7, 2019 · 5 comments
Open

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

EDMB-QA opened this issue Aug 7, 2019 · 5 comments

Comments

@EDMB-QA
Copy link

EDMB-QA commented Aug 7, 2019

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

@o-hook
Copy link

o-hook commented Sep 6, 2019

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.

@o-hook
Copy link

o-hook commented Sep 6, 2019

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!

@mrcnski
Copy link

mrcnski commented Jun 22, 2021

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

@SCG82
Copy link

SCG82 commented Oct 16, 2022

Try

bs_Local.startSync(bsLocalArgs);
console.log('Started BrowserStackLocal', bs_Local.isRunning());

@egarc12
Copy link

egarc12 commented Feb 9, 2023

+1

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

No branches or pull requests

5 participants