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

Throws no error and does not start with proxy enabled #100

Closed
adriaandotcom opened this issue Feb 3, 2020 · 5 comments
Closed

Throws no error and does not start with proxy enabled #100

adriaandotcom opened this issue Feb 3, 2020 · 5 comments

Comments

@adriaandotcom
Copy link

adriaandotcom commented Feb 3, 2020

When trying to start the app (see example below) with proxyHost and proxyPort it will fail. If I add the folder it never starts but also does not fail (no error message given).

Expected Behavior

That it would load correctly without an error or some kind of error in return when specifying f (folder).

Actual Behavior

If I add proxyHost and proxyPort

  const bs_local_args = {
    key: "***",
    localIdentifier: "testing",

    // Never proceeds with the following settings:
    proxyHost: "localhost",
    proxyPort: PORT,

    // If I omit the folder with the proxy settings it returns "LocalError: No output received"
    // f: "/Users/adriaan/folder"
  };
It fails with LocalError: No output received
Started node server
Error: LocalError: No output received
    at /Users/adriaan/node_modules/browserstack-local/lib/Local.js:62:20
    at ChildProcess.exithandler (child_process.js:286:7)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
  name: 'LocalError',
  message: 'No output received',
  extra: undefined
}
/Users/adriaan/node_modules/browserstack-local/lib/Local.js:65
          callback(new LocalError(data['message']['message']));
                                                 ^

TypeError: Cannot read property 'message' of undefined
    at /Users/adriaan/node_modules/browserstack-local/lib/Local.js:65:50
    at ChildProcess.exithandler (child_process.js:286:7)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)

If I uncommend the folder line, it will not start without any error.

Platform details

  1. browserstack-local-nodejs version: 1.4.5
  2. node version: 12.14.0
  3. os type and version: mac os x Catalina

Details

This is a minimal version of the bug:

const browserstack = require("browserstack-local");
const url = require("url");
const http = require("http");
const PORT = 8080;

(async () => {
  http
    .createServer(req => {
      const { pathname } = url.parse(req.url);
      console.log("Request:", pathname);
    })
    .listen(PORT, () => {
      console.log("Started node server");
    });

  const bs_local = new browserstack.Local();

  const bs_local_args = {
    key: "***",
    localIdentifier: "testing",
    forceLocal: "true",

    // Never proceeds with the following settings:
    proxyHost: "localhost",
    proxyPort: PORT,

    // If I omit the folder with the proxy settings it returns "LocalError: No output received"
    // f: "/Users/adriaan/folder"
  };

  bs_local.start(bs_local_args, function(error) {
    if (error) return console.error("Error:", error);
    console.log("Running BrowserStackLocal", bs_local.isRunning());
    bs_local.stop(function() {
      console.log("Stopped BrowserStackLocal");
    });
  });
})();
@RohanImmanuel
Copy link

Hi @adriaanvanrossum,

could you try to updating bs_local_args with

const bs_local_args = {
    key: "***",
    localIdentifier: "testing",
    forceLocal: "true",

    // update here
    'local-proxy-host': "localhost",
    'local-proxy-port': PORT,

    f: "/Users/adriaan/folder"
  };

@adriaandotcom
Copy link
Author

This indeed works! Thanks a lot.

@adriaandotcom
Copy link
Author

If I create a PR for README.md with above new params, will it be merged?

@RohanImmanuel
Copy link

Feel free to create a PR for the same

@adriaandotcom
Copy link
Author

Done: #101

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

3 participants