-
Notifications
You must be signed in to change notification settings - Fork 28
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 configuration behind a proxy is not clear #16
Comments
It'd be nice if someone acknowledged this issue. I aim to spend time next week debugging in that environment to identify if it is a config issue or a library issue |
@lbod i might guess that nobody else has tried using using browserstack behind a proxy and may not be in a position to spend the time to setup an environment to try this so we are not able to acknowledge the issue. it looks like you may be breaking new ground so forge ahead and let us know what you find. |
@neonstalwart I figured as much as no one else has reported this & there's been no meaningful replies on SO; it's fair to say there are no corporate users using intern against browserstack. However, does that configuration above look correct? I'll setup privoxy on my home laptop to try reproduce as I can't justify spending time on this at work |
@lbod it doesn't quite look correct to me since i would assume that your proxy might need a username and password. all the proxy config is extracted from Lines 147 to 161 in 3350f8e
my suggestion would be to initially cut out intern/digdug completely and just download the browserstack local executable yourself, figure out which arguments need to be passed to that executable in order for everything to work with the proxy, and then work backwards from there to figure out what you need in your tunnel config in order for |
@neonstalwart thanks, at the moment we're whitelisting ip's, so no usr/pwd needed but I can add a dummy usr/pwd to make sure there's no funky logic relying on this. I did see generated urls of the form http://"browserstack user name":"browserstack auth key"@hub.browserstack.com:4444/wd/hub/session in Server.createHttpRequest() which didn't look right., also tried adding the |
I undid any hacks I'd made and checked
|
@neonstalwart any advice on where I can stick some breakpoints to see where these requests are coming from to trace it back? |
Just to note I believe dojo/request is the cause, I raised this https://bugs.dojotoolkit.org/ticket/18424 but not had any feedback. This is also relevant to #17 You could consider this as an upstream bug but seeing intern is part of the Dojo foundation it seems wise to keep both these issues open |
Any updates on this issue? Still relevant? |
I suspect it's still relevant to others, not to me or the company I work for as we switched to other various testing libraries which didn't have this issue. |
Hi @jason0x43 ! Crazy I opened this 4 years ago, sorry if this is a long one.. I tried out the typescript/backbone example, upgraded to the latest to make sure and as I suspected it still didn't support CONNECT tunnelling proxies. Intern/dojo's changed a lot since I last looked so there was a bit of digging around first and getting support from the network team in work. dojo's node.js provider just doesn't support it. Eventually I hacked something working and wanted your thoughts the best way to do this. I used https://www.npmjs.com/package/global-tunnel-ng and loaded it as a plugin to see if I could bootstrap the process. Something like : "browser": {
"loader": "systemjs",
"plugins": { "script": "src/config.js", "useLoader": true }
},
"node": {
"plugins": {"script" : "src_node/global-tunnel.js"}
} In that plugin I added the initialise script, something like: var tunnel = require('global-tunnel-ng');
tunnel.initialize({
host: 'xxx.xxx.xxx.xxx',
port: xxxx,
connect: "both",
protocol: "http:"
});
module.exports = tunnel; It got further, (can't remember if it was a 4xx or a 5xx and if it was the BS local binary trying to download) but I still had the proxy config in the tunnel config in intern.json. Removed that and the next error was the browserstack local tunnel binary args (because I'd removed the tunnel proxy property). So I hacked node_modules and just hardcoded the proxy at https://github.com/theintern/digdug/blob/master/src/BrowserStackTunnel.ts#L174 Hey presto, connectivity and the full local unit/functional suite ran. I didn't have time to debug and will look tomorrow why the difference. Any thoughts on how I could inject that proxy config just for the BS local binary? I was sure there's another issue about the same thing. I could try and contribute something back on this as I've learned a bit more about how the hop-by-hop goes. I wouldn't want to be just copying code from that global-tunnel-ng library though but this is an upstream dependency issue with dojo. It might be nice to be able to swap out that request provider dependency to another. |
Hi! Wow, yeah, this one's been around for a while. :) What did your working BS tunnel end up looking like? If we can figure out specifically what handles the problem, we can see about making it a general option for tunnels. Also, have you tried the newest Dig Dug yet? We removed all the |
Quick reply thanks!
It was just removing the proxy property configs : {
"bsproxy" : {
"tunnel" : "browserstack",
"environments" : {
"browserName" : "chrome"
}
}
Maybe I'm not understanding, I had seen the references to axios and seen the TS docs that say it mirrors dojo's request API. At first look it it also seemed to have the same lack of support. But.. Dig Dug is a dependency of intern and I'm using 4.2.4, so Dig Dug is 2.1.2. |
Hi @jason0x43 I wasn't sure if I was to get back to you with more info? https://github.com/theintern/digdug/blob/master/src/Tunnel.ts#L441 the So at the moment I need to be able to separately set the binary proxy arguments. The browserstack binary client can obviously work with CONNECT proxies. Me hardcoding the proxy args into the node_modules package JS (BrowserStackTunnel.js) looked like if (this.proxy) {
const proxy = parseUrl(this.proxy);
proxy.hostname && args.push('-proxyHost', proxy.hostname);
proxy.port && args.push('-proxyPort', proxy.port);
if (proxy.auth) {
const auth = proxy.auth.split(':');
args.push('-proxyUser', auth[0], '-proxyPass', auth[1]);
}
/*else {
proxy.username && args.push('-proxyUser', proxy.username);
proxy.password && args.push('-proxyPass', proxy.password);
}*/
}
// ME HARDCODING
args.push('-proxyHost', "http://xxx.xxx.xxx.xxx");
args.push('-proxyPort', 8080) Does that make sense? |
Hmmm..I'm not sure I understand the core issue. There are at least two network connections involved with Dig Dug tunnels -- Dig Dug has to connect to a server to download the tunnel binary, and the tunnel binary needs to connect to a remote server. Dig Dug assumes that if a proxy is required, both of these connections will use it for outgoing connections. In your fix above, it looks like you're overriding the proxy config that's passed to the BS executable. Is the issue that the BS executable needs to use a different proxy than the one Dig Dug uses to download the executable (maybe Dig Dug doesn't need one but BS does?), or that the existing proxy config isn't being passed properly to the BS executable, or something else entirely? |
Yes, sorry it looks like I'm not explaining this well at all. Effectively I want to separately configure proxy args for the BS executable. Because I'm bootstrapping in this I have no idea if global-tunnel-ng is even a good idea, I want to drive a large suite of tests through it to see if there's any weird stuff, latency etc. However it is the only option we have behind a CONNECT tunneling proxy server because dojo's request/node or axios doesn't support it. |
Ok. What if we add a a {
"tunnelOptions": {
"tunnelProxy": "http://xxx.xxx.xxx.xxx:8080"
}
} The tunnel classes can then use |
Yes that's perfect. Thanks! Do you want me to PR it if it saves you time? You said you were busy and I completely understand that |
Go ahead and PR it. |
Hi @jason0x43 I've been away from work the last week but made the change locally. Will be able to test when I get back, however.. It makes sense to only add a property to the BrowserStackTunnel? (though I do understand that's not ideal). |
I'm not sure #65 is related to this issue; in that case, Dig Dug is unable to download files through a proxy, implying the base Regarding adding the setting for all tunnels, the idea would be to add the |
This commit refers to issue theintern#16
@jason0x43 apologies for my delay. It's a tiny commit but had to keep back and forth testing at work and then was lazy. |
Closing this as resolved by f504f84 |
I've asked on StackOverflow http://stackoverflow.com/questions/26681808/intern-2-configuration-for-browserstack-behind-a-proxy and on IRC.
Current documentation is not sufficient to understand what configuration to use when behind a proxy using BrowserStack. It's a common problem with proxies and IMO, is documented better in other libraries. If this isn't a bug a constructive criticism would be your documentation is incomplete.
Repeating the StackOverflow question:
I'm unsure what the configuration should be running intern 2 tests against BrowserStack when running behind a proxy/firewall and currently seeing errors/timeouts.
My Current configuration is:
Listening on 0.0.0.0:9000
Starting tunnel...
BrowserStackLocal v3.3
Connecting to BrowserStack using WebSocket protocol...
Connected.
Ready
Error: [POST http://(redacted)@:4444/wd/hub/session] connect ETIMEDOUT
Error: connect ETIMEDOUT
at errnoException net.js:904:11
at Object.afterConnect [as oncomplete] net.js:895:19
FATAL ERROR
Error: [POST http://(redacted)@:4444/wd/hub/session] connect ETIMEDOUT
Error: connect ETIMEDOUT
at errnoException net.js:904:11
``` The
[POST http://(redacted)@<myproxyip>:4444/wd/hub/session]
url doesn't seem right. Obviously I have this misconfigured & would appreciate any advice. I do struggle to understand intern's documentation when running behind a proxy.The text was updated successfully, but these errors were encountered: