sorry-cypress / cy2

Integrate Cypress with alternative cloud services like Sorry Cypress or Currents
https://docs.sorry-cypress.dev/cypress-agent/cy2
GNU General Public License v3.0
32 stars 5 forks source link

Unable to use CY2 with a https baseUrl #50

Closed richardmward closed 1 year ago

richardmward commented 1 year ago

Before opening, please confirm:

Environment information

``` System: OS: Windows 10 10.0.19045 CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz Memory: 8.24 GB / 31.89 GB Binaries: Node: 16.14.0 - C:\Program Files\nodejs\node.EXE npm: 8.17.0 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: 108.0.5359.125 Edge: Spartan (44.19041.1266.0) ```

Describe the bug

Using cy2 4.0.1 and Cypress 12.3.0 I am unable to use the new run command with an https baseUrl in my config (see logs below). This was working a few days ago as I was just having trouble then with the command not returning the promise (https://github.com/sorry-cypress/cy2/issues/38#issuecomment-1371027760).

Expected behavior

To be able to use an https baseUrl.

Log and debug output

``` cypress:server:ensure-url checking that baseUrl is available { baseUrl: 'https://www.example.com', delaysRemaining: [ 3000, 3000, 4000 ], retryIntervals: [ 3000, 3000, 4000 ] } +0ms cypress:network:agent addRequest called { isHttps: true, href: 'https://www.example.com/' } +0ms cypress:network:agent got family { family: undefined, href: 'https://www.example.com/' } +4ms cypress:network:agent Creating proxied socket for https://www.example.com/ through https://undefined +8ms cypress:network:connect retries exhausted, bubbling up error { iteration: 0, err: Error: getaddrinfo ENOTFOUND undefined at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) { errno: -3008, code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'undefined' } } +0ms Cypress could not verify that this server is running: > https://www.example.com We are verifying this server because it has been configured as your baseUrl. ```

Additional information and screenshots

Self hosted Sorry Cypress instance

pkell commented 1 year ago

Having the same issue. Interestingly it only happens when calling cy2.run I can successfully run using the CLI

agoldis commented 1 year ago

@richardmward @pkell would appreciate if you share:

pkell commented 1 year ago

@agoldis Is there a specific debug i should set for cypress to cut it down to what you need? I did just notice this when running programmatically

cypress:network:agent Creating proxied socket for https://mytesturl/ through https://undefined +2ms

The undefined is instead cypress:network:agent Creating proxied socket for https://mytesturl/ through http://127.0.0.1:62761 +4ms when running through CLI

agoldis commented 1 year ago

@richardmward @pkell Please try cy2@4.0.2

agoldis commented 1 year ago

Reopening until received the confirmation

richardmward commented 1 year ago

That works, thanks (and thanks for changing to Partial<CypressCommandLine.CypressRunOptions> - I was going to raise that!)

The promise still doesn't resolve, so it ends up never returning from await run(...). The logs after the test run are as follows, and then it just sits there:

  cypress:server:cypress about to exit with code 5 +2m
  cypress:server:browsers browsers.kill called with no active instance +9s
  cypress:proxy:http:util:prerequests metrics: { browserPreRequestsReceived: 140, proxyRequestsReceived: 10, immediatelyMatchedRequests: 10, unmatchedRequests: 0, unmatchedPreRequests: 106 } +0ms

───────────────────────────────────────────────────────────────────────────────────────────────────────

  Recorded Run: https://my-director-service.com/run/2a1898e59103f870b53e178d5a46eece

  cypress:cli child event fired { event: 'exit', code: 5, signal: null } +2m
  cypress:cli child event fired { event: 'close', code: 5, signal: null } +1ms
agoldis commented 1 year ago

@richardmward this should resolve the issue with a hung promise. Please try out cy2@4.0.3

richardmward commented 1 year ago

Spot on. Thank you!

pkell commented 1 year ago

@agoldis Works perfectly now. Thanks again!

agoldis commented 1 year ago

🎉