Skip to content

NO_PROXY ignored when baseUrl is set #4303

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

Closed
skydever opened this issue May 24, 2019 · 4 comments · Fixed by #4309
Closed

NO_PROXY ignored when baseUrl is set #4303

skydever opened this issue May 24, 2019 · 4 comments · Fixed by #4309

Comments

@skydever
Copy link

Current behavior:

I am behind a corporate proxy and want to test against an internal URL, no proxy should be used. To do so I added the host of the baseUrl to the environment variable NO_PROXY and no_proxy (I also have HTTP_PROXY, http_proxy, HTTPS_PROXY and https_proxy set up, pointing to the corporate proxy).

When I run cypress I get the error:

Cypress could not verify that this server is running:

  > https://<my-domain>/<context-root>/

We are verifying this server because it has been configured as your `baseUrl`.

Cypress automatically waits until your server is accessible before running tests.

We will try connecting to it 3 more times...
We will try connecting to it 2 more times...
We will try connecting to it 1 more time...

Cypress failed to verify that your server is running.

Please start this server and then run Cypress again.

Output with DEBUG=cypress:* on:

  cypress:cli verifying Cypress app +0ms
  cypress:cli checking environment variables +2ms
  cypress:cli checking if executable exists C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress\Cypress.exe +2ms
  cypress:cli Binary is executable? : true +1ms
  cypress:cli binaryDir is  C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress +1ms
  cypress:cli Reading binary package.json from: C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\package.json +0ms
  cypress:cli Found binary version 3.3.1 installed in: C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress +3ms
  cypress:cli { verified: true } +5ms
  cypress:cli is Verified ? true +3ms
  cypress:cli processing run options +0ms
  cypress:cli --key is not set, looking up environment variable CYPRESS_RECORD_KEY +0ms
  cypress:cli run to spawn.start args ["--run-project","apps/<context-root>-e2e","--config","{\"baseUrl\":\"https://<my-domain>/<context-root>/\"}","--record",false,"--output-path","C:\\Users\\skydever\\AppData\\Local\\Temp\\tmp-5600xlL3rio34MOO"] +1ms
  cypress:cli needs to start own Xvfb? false +0ms
  cypress:cli spawning, should retry on display problem? false +1ms
  cypress:cli spawning Cypress with executable: C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress\Cypress.exe +13ms
  cypress:cli spawn args [ '--run-project', 'apps/<context-root>-e2e', '--config', '{"baseUrl":"https://<my-domain>/<context-root>/"}', '--record', false, '--output-path', 'C:\\Users\\skydever\\AppData\\Local\\Temp\\tmp-5600xlL3rio34MOO', '--cwd', 'D:\\<path-to-my-project>' ] { detached: false, stdio: 'pipe', windowsHide: false } +0ms

  cypress:ts Running without ts-node hook in environment "production" +0ms
  cypress:server:cypress starting cypress with argv [ 'C:\\Users\\skydever\\AppData\\Local\\Cypress\\Cache\\3.3.1\\Cypress\\Cypress.exe', '--run-project', 'apps/<context-root>-e2e', '--config', '{"baseUrl":"https://<my-domain>/<context-root>/"}', '--record', 'false', '--output-path', 'C:\\Users\\skydever\\AppData\\Local\\Temp\\tmp-5600xlL3rio34MOO', '--cwd', 'D:\\<path-to-my-project>' ] +0ms
  cypress:server:args argv array: [ 'C:\\Users\\skydever\\AppData\\Local\\Cypress\\Cache\\3.3.1\\Cypress\\Cypress.exe', '--run-project', 'apps/<context-root>-e2e', '--config', '{"baseUrl":"https://<my-domain>/<context-root>/"}', '--record', 'false', '--output-path', 'C:\\Users\\skydever\\AppData\\Local\\Temp\\tmp-5600xlL3rio34MOO', '--cwd', 'D:\\<path-to-my-project>' ] +0ms
  cypress:server:args argv parsed: { _: [ 'C:\\Users\\skydever\\AppData\\Local\\Cypress\\Cache\\3.3.1\\Cypress\\Cypress.exe' ], runProject: 'apps/<context-root>-e2e', config: '{"baseUrl":"https://<my-domain>/<context-root>/"}', record: false, outputPath: 'C:\\Users\\skydever\\AppData\\Local\\Temp\\tmp-5600xlL3rio34MOO', cwd: 'D:\\<path-to-my-project>' } +6ms
  cypress:server:args options { _: [ 'C:\\Users\\skydever\\AppData\\Local\\Cypress\\Cache\\3.3.1\\Cypress\\Cypress.exe' ], runProject: 'apps/<context-root>-e2e', config: { baseUrl: 'https://<my-domain>/<context-root>/' }, record: false, outputPath: 'C:\\Users\\skydever\\AppData\\Local\\Temp\\tmp-5600xlL3rio34MOO', cwd: 'D:\\<path-to-my-project>', proxyServer: 'http://<proxy-ip>:<proxy-port>', proxyBypassList: '<my-domain>' } +1ms
  cypress:server:args argv options: { _: [ 'C:\\Users\\skydever\\AppData\\Local\\Cypress\\Cache\\3.3.1\\Cypress\\Cypress.exe' ], runProject: 'apps/<context-root>-e2e', config: { baseUrl: 'https://<my-domain>/<context-root>/' }, record: false, outputPath: 'C:\\Users\\skydever\\AppData\\Local\\Temp\\tmp-5600xlL3rio34MOO', cwd: 'D:\\<path-to-my-project>', proxyServer: 'http://<proxy-ip>:<proxy-port>', proxyBypassList: '<my-domain>', projectRoot: 'D:\\<path-to-my-project>\\apps\\<context-root>-e2e', run: true } +0ms
  cypress:server:appdata path: C:\Users\skydever\AppData\Roaming\Cypress\cy\production +0ms
  cypress:server:cypress starting in mode run +2s
  cypress:server:appdata path: C:\Users\skydever\AppData\Roaming\Cypress\cy\production +4s
  cypress:server:appdata path: C:\Users\skydever\AppData\Roaming\Cypress\cy\production\cache +880ms
  cypress:server:appdata path: C:\Users\skydever\AppData\Roaming\Cypress\cy\production\browsers +16s
  cypress:server:timers queuing timer id 1 after 500 ms +0ms
  cypress:server:timers child received timer id 1 +0ms
  cypress:server:timers child sending timer id 1 +504ms
  cypress:server:timers clearing timer id 1 from queue { '1': { args: [], ms: 500, cb: [Function] } } +508ms
  cypress:server:run run mode ready with options { _: [ 'C:\\Users\\skydever\\AppData\\Local\\Cypress\\Cache\\3.3.1\\Cypress\\Cypress.exe' ], runProject: 'apps/<context-root>-e2e', config: { baseUrl: 'https://<my-domain>/<context-root>/' }, record: false, outputPath: 'C:\\Users\\skydever\\AppData\\Local\\Temp\\tmp-5600xlL3rio34MOO', cwd: 'D:\\<path-to-my-project>', proxyServer: 'http://<proxy-ip>:<proxy-port>', proxyBypassList: '<my-domain>', projectRoot: 'D:\\<path-to-my-project>\\apps\\<context-root>-e2e', run: true } +0ms
  cypress:server:project Project created D:\<path-to-my-project>\apps\<context-root>-e2e +0ms
  cypress:server:openproject opening project D:\<path-to-my-project>\apps\<context-root>-e2e +0ms
  cypress:server:project opening project instance D:\<path-to-my-project>\apps\<context-root>-e2e +0ms
  cypress:server:config setting plugins file D:\<path-to-my-project>\dist\out-tsc\apps\<context-root>-e2e\src\plugins\index.js +0ms
  cypress:server:config for project root D:\<path-to-my-project>\apps\<context-root>-e2e +0ms
  cypress:server:config set pluginsFile to D:\<path-to-my-project>\dist\out-tsc\apps\<context-root>-e2e\src\plugins\index.js +1ms
  cypress:server:config set scaffold paths +0ms
  cypress:server:scaffold scaffolded files ["..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\integration\\examples\\actions.spec.js","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\integration\\examples\\aliasing.spec.js","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\integration\\examples\\assertions.spec.js","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\integration\\examples\\connectors.spec.js","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\integration\\examples\\cookies.spec.js","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\integration\\examples\\cypress_api.spec.js","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\integration\\examples\\files.spec.js","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\integration\\examples\\local_storage.spec.js","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\integration\\examples\\location.spec.js","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\integration\\examples\\misc.spec.js","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\integration\\examples\\navigation.spec.js","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\integration\\examples\\network_requests.spec.js","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\integration\\examples\\querying.spec.js","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\integration\\examples\\spies_stubs_clocks.spec.js","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\integration\\examples\\traversal.spec.js","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\integration\\examples\\utilities.spec.js","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\integration\\examples\\viewport.spec.js","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\integration\\examples\\waiting.spec.js","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\integration\\examples\\window.spec.js","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\fixtures\\example.json","..\\..\\dist\\out-tsc\\apps\\<context-root>-e2e\\src\\plugins\\index.js"] +0ms
  cypress:server:config got file tree +4ms
  cypress:server:project get saved state +22ms
  cypress:server:saved_state noop saved state +0ms
  cypress:server:scaffold plugins folder D:\<path-to-my-project>\dist\out-tsc\apps\<context-root>-e2e\src\plugins +2ms
  cypress:server:plugins plugins.init D:\<path-to-my-project>\dist\out-tsc\apps\<context-root>-e2e\src\plugins\index.js +0ms
  cypress:server:plugins:child pluginsFile: D:\<path-to-my-project>\dist\out-tsc\apps\<context-root>-e2e\src\plugins\index.js +0ms
  cypress:server:plugins:child require pluginsFile +4ms
  cypress:server:plugins:child run plugins function +5ms
  cypress:server:plugins:child register event _get:task:body with id 0 +0ms
  cypress:server:plugins:child register event _get:task:keys with id 1 +0ms
  cypress:server:plugins register plugins process event _get:task:body with id 0 +370ms
  cypress:server:plugins register event '_get:task:body' +0ms
  cypress:server:plugins register plugins process event _get:task:keys with id 1 +0ms
  cypress:server:plugins register event '_get:task:keys' +0ms
  cypress:server:project plugin config yielded: null +374ms
  cypress:server:buffers resetting buffers +0ms
  cypress:server:server Server listening on  { address: '127.0.0.1', family: 'IPv4', port: 64997 } +0ms
  cypress:server:appdata path: C:\Users\skydever\AppData\Roaming\Cypress\cy\production\proxy +3s
  cypress:https-proxy Created SNI HTTPS Proxy on port 64999 +0ms
  cypress:server:ensure-url checking that baseUrl is available { baseUrl: 'https://<my-domain>/<context-root>/',
  delaysRemaining: [ 3000, 3000, 4000 ],
  retryIntervals: [ 3000, 3000, 4000 ] } +0ms
  cypress:network:agent addRequest called for https://<my-domain>/<context-root>/ +0ms
  cypress:network:agent Creating proxied socket for https://<my-domain>/<context-root>/ through  +1ms
Cypress could not verify that this server is running:

  > https://<my-domain>/<context-root>/

We are verifying this server because it has been configured as your `baseUrl`.

Cypress automatically waits until your server is accessible before running tests.

We will try connecting to it 3 more times...
  cypress:server:timers child received timer id 2 +2s
  cypress:server:timers queuing timer id 2 after 3000 ms +2s
  cypress:server:timers child sending timer id 2 +3s
  cypress:server:timers clearing timer id 2 from queue { '2': { args: [], ms: 3000, cb: [Function] } } +3s
  cypress:server:ensure-url checking that baseUrl is available { baseUrl: 'https://<my-domain>/<context-root>/',
  delaysRemaining: [ 3000, 4000 ],
  retryIntervals: [ 3000, 3000, 4000 ] } +3s
  cypress:server:timers child received timer id 3 +6ms
  cypress:network:agent addRequest called for https://<my-domain>/<context-root>/ +3s
  cypress:network:agent Creating proxied socket for https://<my-domain>/<context-root>/ through  +1ms
We will try connecting to it 2 more times...
  cypress:server:timers queuing timer id 3 after 3000 ms +5ms
  cypress:server:timers child sending timer id 3 +3s
  cypress:server:timers clearing timer id 3 from queue { '3': { args: [], ms: 3000, cb: [Function] } } +3s
  cypress:server:ensure-url checking that baseUrl is available { baseUrl: 'https://<my-domain>/<context-root>/',
  delaysRemaining: [ 4000 ],
  retryIntervals: [ 3000, 3000, 4000 ] } +3s
  cypress:server:timers child received timer id 4 +5ms
  cypress:network:agent addRequest called for https://<my-domain>/<context-root>/ +3s
  cypress:network:agent Creating proxied socket for https://<my-domain>/<context-root>/ through  +1ms
We will try connecting to it 1 more time...

  cypress:server:timers queuing timer id 4 after 4000 ms +5ms
  cypress:server:timers child sending timer id 4 +4s
  cypress:server:timers clearing timer id 4 from queue { '4': { args: [], ms: 4000, cb: [Function] } } +4s
  cypress:server:ensure-url checking that baseUrl is available { baseUrl: 'https://<my-domain>/<context-root>/',
  delaysRemaining: [],
  retryIntervals: [ 3000, 3000, 4000 ] } +4s
  cypress:network:agent addRequest called for https://<my-domain>/<context-root>/ +4s
  cypress:network:agent Creating proxied socket for https://<my-domain>/<context-root>/ through  +0ms
  cypress:server:server RequestError: Error: A connection to the upstream proxy could not be established: Unsupported proxy protocol: null
  cypress:server:server     at new RequestError (C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\server\node_modules\request-promise-core\lib\errors.js:14:15)
  cypress:server:server     at Request.plumbing.callback (C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\server\node_modules\request-promise-core\lib\plumbing.js:87:29)
  cypress:server:server     at Request.RP$callback [as _callback] (C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\server\node_modules\request-promise-core\lib\plumbing.js:46:31)
  cypress:server:server     at self.callback (C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\server\node_modules\request\request.js:185:22)

  cypress:server:server     at emitOne (events.js:116:13)
  cypress:server:server     at Request.emit (events.js:211:7)
  cypress:server:server     at Request.onRequestError (C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\server\node_modules\request\request.js:881:8)
  cypress:server:server     at emitOne (events.js:116:13)
  cypress:server:server     at ClientRequest.emit (events.js:211:7)
  cypress:server:server     at nextTick (_http_agent.js:334:39)
  cypress:server:server     at _combinedTickCallback (internal/process/next_tick.js:131:7)
  cypress:server:server     at process._tickCallback (internal/process/next_tick.js:180:9)
  cypress:server:server  +10s
  cypress:server:server Setting remoteAuth undefined +3ms
  cypress:server:cors Parsed URL { port: '443', tld: 'net', domain: 'siemens' } +0ms
  cypress:server:server Setting remoteOrigin https://<my-domain> +32ms
  cypress:server:server Setting remoteHostAndPort { port: '443', tld: 'net', domain: 'siemens' } +0ms
  cypress:server:server Setting remoteDocDomain siemens.net +0ms
  cypress:server:server Getting remote state: { auth: undefined, props: { port: '443', tld: 'net', domain: 'siemens' }, origin: 'https://<my-domain>', strategy: 'http', visiting: undefined, domainName: 'siemens.net', fileServer: null } +0ms
  cypress:server:cypress exiting with err { Error: Cypress failed to verify that your server is running.

Please start this server and then run Cypress again.
    at Object.get (C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\server\lib\errors.js:292:11)
    at C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\server\lib\server.js:245:42
    at tryCatcher (C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\server\node_modules\request-promise\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\server\node_modules\request-promise\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\server\node_modules\request-promise\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromise0 (C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\server\node_modules\request-promise\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\server\node_modules\request-promise\node_modules\bluebird\js\release\promise.js:690:18)
    at _drainQueueStep (C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\server\node_modules\request-promise\node_modules\bluebird\js\release\async.js:138:12)
    at _drainQueue (C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\server\node_modules\request-promise\node_modules\bluebird\js\release\async.js:131:9)
    at Async._drainQueues (C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\server\node_modules\request-promise\node_modules\bluebird\js\release\async.js:147:5)
    at Immediate.Async.drainQueues (C:\Users\skydever\AppData\Local\Cypress\Cache\3.3.1\Cypress\resources\app\packages\server\node_modules\request-promise\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)

  isCypressErr: true,
  type: 'CANNOT_CONNECT_BASE_URL',
  details: undefined } +34s
Cypress failed to verify that your server is running.

Please start this server and then run Cypress again.
  cypress:server:cypress about to exit with code 1 +1ms

When I remove all the proxy env. variables everything is working.

Desired behavior:

NO_PROXY should be considered.

Steps to reproduce: (app code and test code)

Set env. variables HTTP_PROXY + HTTPS_PROXY to a valid proxy.
Set the domain of the baseUrl as value for the env. variable NO_PROXY.
Run the tests.

Versions

Cypress: 3.3.1
OS: Windows 7 Enterprise
Running with the included Electron client

Prior Cypress 3.3.1/3.3.0 I had no issues concerning proxies.

Thank you a lot, Cypress is awesome!!

@flotwig
Copy link
Contributor

flotwig commented May 24, 2019

Yeah, in Cypress 3.3.0 we added first-class support for proxies; unfortunately, this means that some new bugs are cropping up.

I'm able to reproduce this behavior for HTTPS baseurls only, looking in to a fix now.

@skydever
Copy link
Author

thx a lot! 👍

@cypress-bot cypress-bot bot added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: work in progress labels May 24, 2019
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Jun 14, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jun 14, 2019

The code for this is done in cypress-io/cypress#4309, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jun 27, 2019

Released in 3.3.2.

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

Successfully merging a pull request may close this issue.

2 participants