Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Browserstack update job status not working behind proxy #4027

Open
wouterpol opened this issue Jan 27, 2017 · 5 comments
Open

Browserstack update job status not working behind proxy #4027

wouterpol opened this issue Jan 27, 2017 · 5 comments

Comments

@wouterpol
Copy link

I got browserstack behind a proxy working using browserstack local and setting the webDriverProxy.
The test runs fine and I can see my test on browserstack. After the test run, protractor tries to update the status of the run to browserstack. At this point it hangs and results in a timeout: ETIMEDOUT causing protractor to exit with a uncaught exception.

After some debugging I traced the error to driverProviders/browserStack.js line 48. The request to browserstack hangs and times-out. It seems like the https request does not use the proxy.
According to this site "http://blog.vanamco.com/proxy-requests-in-node-js/" it is not possible to use a proxy with https (security issue). One should use a tunnel via the proxy for the https traffic. There is a dependency, suggested in the blog post, that does this called https-proxy-agent (https://www.npmjs.com/package/https-proxy-agent).

By adding the dependency and this small piece of code in broserStack.js after the options (line 47) :
if(_this.config_.webDriverProxy !== undefined){ options.agent = new HttpsProxyAgent(_this.config_.webDriverProxy); }
I got the update working and the test succeed.

  • Steps to reproduce the bug
  1. Set-up a browserstack test with a proxy and local browserstack.
  2. Use the new protractor browserstack settings (Remove seleniumAddress from your config and use the --browserstackUser and --browserstackKey)
@cnishina
Copy link
Member

This sounds like a bug and it sounds like you have a working fix. Could you send us a pull request?

@wouterpol
Copy link
Author

Before I create a pull request. Can you tell me how/where I add a new dependency to protractor? How is this handled?

@cnishina
Copy link
Member

cnishina commented Feb 3, 2017

I would edit /lib/driverProviders/browserStack.ts. If you plan to use https-proxy-agent node_module, add it to the package.json as a dependency.

We will review it. Also, it appears that @types/https-proxy-agent does not exist, you could do one of the following:

  1. create the DefinitelyTyped definition and add @types/https-proxy-agent as a devDependency.
  2. const httpsProxyAgent = require('https-proxy-agent'). If you plan to go through this route, make sure to add a comment with // TODO: fix when @types/https-proxy-agent is published. Since types are not known, you'll have to set many of the definitions to any.

@heroinedor
Copy link

I have exactly the same bug/problem and it would be helpful to have it fixed.
The fix seems good to me.
Is it mandatory to wait for the Type version of https-proxy-agent or is it possible to make the PR with only the actual version of https-proxy-agent ?

@raghuhit
Copy link
Contributor

Hi, I have submitted a PR #4852 to fix this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants