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

write EPROTO: SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure when visiting https site #4394

Closed
flotwig opened this issue Jun 5, 2019 · 19 comments · Fixed by #4720
Closed
Labels
topic: network type: regression A bug that didn't appear until a specific Cy version release

Comments

@flotwig
Copy link
Contributor

flotwig commented Jun 5, 2019

I'm on OS X and I've trusted my self signed cert in keychain. Chrome lets me into the site with no warnings or indication that I'm using a self-signed cert. However, when I try to cy.visit I get the following error in the cypress UI:

CypressError: cy.visit() failed trying to load:

https://local.avoxi.com/

We attempted to make an http request to this URL but the request failed without a response.

We received this error at the network level:

  > Error: write EPROTO 4777985472:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure:../../vendor/node/deps/openssl/openssl/ssl/s23_clnt.c:802:

Common situations why this would fail:
  - you don't have internet access
  - you forgot to run / boot your web server
  - your web server isn't accessible
  - you have weird network configuration settings on your computer

The stack trace for this error is:

Error: write EPROTO 4777985472:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure:../../vendor/node/deps/openssl/openssl/ssl/s23_clnt.c:802:

    at _errnoException (util.js:1024:11)
    at WriteWrap.afterWrite (net.js:867:14)


Because this error occurred during a 'before each' hook we are skipping the remaining tests in the current suite: 'Smoke Test'

The issue is new to 3.3.x. This test ran correctly in 3.2.x.

Here's the debug log:

  cypress:server:timers clearing timer id 31 from queue { '31': { args: [], ms: 85000, cb: [Function] }, '32': { args: [], ms: 85000, cb: [Function] } } +8s
  cypress:server:timers queuing timer id 34 after 85000 ms +1ms
  cypress:server:events sending ipc data { type: 'on:spec:changed', data: { id: 0.7674737586596712, data: 'integration/smokeTest_spec.js' } } +7s
  cypress:server:timers child received timer id 34 +6s
  cypress:server:timers clearing timer id 34 from queue { '32': { args: [], ms: 85000, cb: [Function] }, '34': { args: [], ms: 85000, cb: [Function] } } +16ms
  cypress:server:timers queuing timer id 35 after 85000 ms +0ms
  cypress:server:socket watch test file 'integration/smokeTest_spec.js' +8s
  cypress:server:timers child received timer id 35 +16ms
  cypress:server:server Getting remote state: { auth: undefined, props: null, origin: 'http://localhost:54628', strategy: 'file', visiting: undefined, domainName: 'localhost', fileServer: 'http://localhost:54629' } +4s
GET /__cypress/iframes/integration/smokeTest_spec.js 200 5.775 ms - 730
  cypress:server:controllers:spec request for { spec: 'cypress/support/index.js' } +8s
  cypress:server:preprocessor getFile /Users/patrick.alessi/dev/go/src/bitbucket.org/AVOXI/sdp/sdp-integration-testing/cypress/support/index.js +9s
  cypress:server:plugins plugin event registered? { event: 'file:preprocessor', isRegistered: true } +9s
  cypress:server:plugins execute plugin event 'file:preprocessor' with args: EventEmitter { domain: null, _events: { rerun: [Function], close: [Function] }, _eventsCount: 2, _maxListeners: undefined, filePath: '/Users/patrick.alessi/dev/go/src/bitbucket.org/AVOXI/sdp/sdp-integration-testing/cypress/support/index.js', shouldWatch: true, outputPath: '/Users/patrick.alessi/Library/Application Support/Cypress/cy/production/projects/sdp-integration-testing-bb0ca3d28a95e02fcfd94de45ff54783/bundles/cypress/support/index.js' } undefined undefined +0ms
  cypress:browserify get: /Users/patrick.alessi/dev/go/src/bitbucket.org/AVOXI/sdp/sdp-integration-testing/cypress/support/index.js +8s
  cypress:browserify already have bundle for: /Users/patrick.alessi/dev/go/src/bitbucket.org/AVOXI/sdp/sdp-integration-testing/cypress/support/index.js +0ms
  cypress:server:controllers:spec sending spec { filePath: '/Users/patrick.alessi/Library/Application Support/Cypress/cy/production/projects/sdp-integration-testing-bb0ca3d28a95e02fcfd94de45ff54783/bundles/cypress/support/index.js' } +2ms
  cypress:server:controllers:spec request for { spec: 'cypress/integration/smokeTest_spec.js' } +1ms
  cypress:server:preprocessor getFile /Users/patrick.alessi/dev/go/src/bitbucket.org/AVOXI/sdp/sdp-integration-testing/cypress/integration/smokeTest_spec.js +2ms
  cypress:server:plugins plugin event registered? { event: 'file:preprocessor', isRegistered: true } +2ms
  cypress:server:plugins execute plugin event 'file:preprocessor' with args: EventEmitter { domain: null, _events: { rerun: [Function], close: [Function] }, _eventsCount: 2, _maxListeners: undefined, filePath: '/Users/patrick.alessi/dev/go/src/bitbucket.org/AVOXI/sdp/sdp-integration-testing/cypress/integration/smokeTest_spec.js', shouldWatch: true, outputPath: '/Users/patrick.alessi/Library/Application Support/Cypress/cy/production/projects/sdp-integration-testing-bb0ca3d28a95e02fcfd94de45ff54783/bundles/cypress/integration/smokeTest_spec.js' } undefined undefined +0ms
  cypress:browserify get: /Users/patrick.alessi/dev/go/src/bitbucket.org/AVOXI/sdp/sdp-integration-testing/cypress/integration/smokeTest_spec.js +3ms
  cypress:browserify already have bundle for: /Users/patrick.alessi/dev/go/src/bitbucket.org/AVOXI/sdp/sdp-integration-testing/cypress/integration/smokeTest_spec.js +0ms
  cypress:server:controllers:spec sending spec { filePath: '/Users/patrick.alessi/Library/Application Support/Cypress/cy/production/projects/sdp-integration-testing-bb0ca3d28a95e02fcfd94de45ff54783/bundles/cypress/integration/smokeTest_spec.js' } +1ms
GET /__cypress/tests?p=cypress/support/index.js-355 200 4.206 ms - -
GET /__cypress/tests?p=cypress/integration/smokeTest_spec.js-909 200 2.427 ms - -
  cypress:server:timers clearing timer id 35 from queue { '32': { args: [], ms: 85000, cb: [Function] }, '35': { args: [], ms: 85000, cb: [Function] } } +26ms
  cypress:server:timers queuing timer id 36 after 85000 ms +1ms
  cypress:server:timers child received timer id 36 +27ms
  cypress:server:timers clearing timer id 36 from queue { '32': { args: [], ms: 85000, cb: [Function] }, '36': { args: [], ms: 85000, cb: [Function] } } +12ms
  cypress:server:timers queuing timer id 37 after 85000 ms +0ms
  cypress:server:socket automation:request get:cookies { domain: 'localhost' } +39ms
  cypress:server:timers child received timer id 37 +12ms
  cypress:server:cookies getting:cookies { domain: 'localhost' } +8s
  cypress:server:timers clearing timer id 32 from queue { '32': { args: [], ms: 85000, cb: [Function] }, '37': { args: [], ms: 85000, cb: [Function] } } +3ms
  cypress:server:timers queuing timer id 38 after 85000 ms +0ms
  cypress:server:timers child received timer id 38 +3ms
  cypress:server:cookies received get:cookies [] +3ms
  cypress:server:timers clearing timer id 38 from queue { '37': { args: [], ms: 85000, cb: [Function] }, '38': { args: [], ms: 85000, cb: [Function] } } +8ms
  cypress:server:timers queuing timer id 39 after 85000 ms +1ms
  cypress:server:timers child received timer id 39 +9ms
  cypress:server:timers clearing timer id 37 from queue { '37': { args: [], ms: 85000, cb: [Function] }, '39': { args: [], ms: 85000, cb: [Function] } } +4ms
  cypress:server:timers queuing timer id 40 after 85000 ms +0ms
  cypress:server:timers child received timer id 40 +4ms
  cypress:server:socket backend:request { eventName: 'resolve:url', args: [ 'https://local.avoxi.com/', { auth: null, failOnStatusCode: false, retryOnNetworkFailure: true, retryOnStatusCodeFailure: false, method: 'GET', body: null, headers: {}, timeout: 30000 } ] } +16ms
  cypress:server:server resolving visit { url: 'https://local.avoxi.com/', headers: { host: 'localhost:54628', connection: 'Upgrade', pragma: 'no-cache', 'cache-control': 'no-cache', 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36', upgrade: 'websocket', origin: 'http://localhost:54628', 'sec-websocket-version': '13', 'accept-encoding': 'gzip, deflate, br', 'accept-language': 'en-US,en;q=0.9', 'sec-websocket-key': 'YFL2TN8ze8mLM11wCa6JNA==', 'sec-websocket-extensions': 'permessage-deflate; client_max_window_bits' }, options: { auth: null, failOnStatusCode: false, retryOnNetworkFailure: true, retryOnStatusCodeFailure: false, method: 'GET', body: null, headers: {}, timeout: 30000 } } +52ms
  cypress:server:server Getting remote state: { auth: undefined, props: null, origin: 'http://localhost:54628', strategy: 'file', visiting: undefined, domainName: 'localhost', fileServer: 'http://localhost:54629' } +0ms
  cypress:server:server sending request with options { auth: null, failOnStatusCode: false, retryOnNetworkFailure: true, retryOnStatusCodeFailure: false, method: 'GET', body: null, headers: { accept: 'text/html,*/*' }, timeout: 30000, gzip: false, url: 'https://local.avoxi.com/', onBeforeReqInit: [Function: runPhase], followRedirect: [Function: followRedirect] } +0ms
  cypress:server:cookies getting:cookies { url: 'https://local.avoxi.com/' } +15ms
  cypress:server:timers clearing timer id 39 from queue { '39': { args: [], ms: 85000, cb: [Function] }, '40': { args: [], ms: 85000, cb: [Function] } } +4ms
  cypress:server:timers queuing timer id 41 after 85000 ms +1ms
  cypress:server:timers child received timer id 41 +5ms
  cypress:server:cookies received get:cookies [ { name: '_ga', value: 'GA1.2.1325448659.1559740807', path: '/', domain: '.avoxi.com', secure: false, httpOnly: false, hostOnly: false, expiry: 1622824507 }, { name: '_gid', value: 'GA1.2.1673151547.1559740807', path: '/', domain: '.avoxi.com', secure: false, httpOnly: false, hostOnly: false, expiry: 1559838907 }, { name: 'SnapABugRef', value: 'https%3A%2F%2Flocal.avoxi.com%2F%20', path: '/', domain: 'local.avoxi.com', secure: false, httpOnly: false, hostOnly: true, expiry: 1559759707 }, { name: 'SnapABugHistory', value: '2#', path: '/', domain: 'local.avoxi.com', secure: false, httpOnly: false, hostOnly: true, expiry: 1591288507 } ] +3ms
  cypress:server:request sending request as stream { auth: null, failOnStatusCode: false, retryOnNetworkFailure: true, retryOnStatusCodeFailure: false, method: 'GET', body: null, headers: { accept: 'text/html,*/*', 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36' }, timeout: 30000, gzip: false, url: 'https://local.avoxi.com/', onBeforeReqInit: [Function: runPhase] } +4s
  cypress:network:agent addRequest called for https://local.avoxi.com/ +4s
  cypress:server:timers queuing timer id 42 after 30000 ms +4ms
  cypress:server:timers child received timer id 42 +5ms
  cypress:server:timers clearing timer id 42 from queue { '40': { args: [], ms: 85000, cb: [Function] }, '41': { args: [], ms: 85000, cb: [Function] }, '42': { args: [], ms: 30000, cb: [Function] } } +1ms
  cypress:server:request received an error making http request { auth: null, failOnStatusCode: false, retryOnNetworkFailure: true, retryOnStatusCodeFailure: false, method: 'GET', body: null, headers: { accept: 'text/html,*/*', 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36' }, timeout: 30000, gzip: false, url: 'https://local.avoxi.com/', onBeforeReqInit: [Function: runPhase], requestId: 'request6', retryIntervals: [ 0, 1000, 2000, 2000 ], delaysRemaining: [ 0, 1000, 2000, 2000 ], err: { Error: write EPROTO 4474762688:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure:../../vendor/node/deps/openssl/openssl/ssl/s23_clnt.c:802: at _errnoException (util.js:1024:11) at WriteWrap.afterWrite (net.js:867:14) code: 'EPROTO', errno: 'EPROTO', syscall: 'write' } } +6ms

Originally posted by @PWAlessi in #771 (comment)

@flotwig
Copy link
Contributor Author

flotwig commented Jun 5, 2019

@PWAlessi Is https://local.avoxi.com/ your Cypress baseUrl, or are you doing cy.visit('https://local.avoxi.com/') directly?

Does switching the URL to https://local.avoxi.com:443/ cause it to work for you?

@flotwig flotwig added topic: network type: regression A bug that didn't appear until a specific Cy version release labels Jun 5, 2019
@PWAlessi
Copy link

PWAlessi commented Jun 5, 2019

I'm reading the url from Cypress.env because I have a bunch of different configurations that I need to test:

const testEnvironment = Cypress.env('testEnvironment')
const environment = Cypress.env(testEnvironment)
const testUserRole = Cypress.env('testUserRole')
const credentials = environment[testUserRole]

Cypress.Commands.add('login', () => {
  cy.visit(environment.url)
  cy.get('[placeholder$="Email"]').type(credentials.email)
  cy.get('[placeholder$="Password"]').type(credentials.password)
  cy.get('form')
    .contains('Log In')
    .should('be.enabled')
    .click()
  cy.url().should('include', '/activity')
})

Cypress.Commands.add('logout', () => {
  cy.get('.bold').contains(credentials.name)
  cy.get('.lightweight').contains(credentials.roleName)
  cy.get('#dropdownArrow').click()
  cy.get('#logout').click()
})

environment.url is https://local.avoxi.com.

Same issue with https://local.avoxi.com:443

@PWAlessi
Copy link

PWAlessi commented Jun 5, 2019

Changing to a request instead of visit yields a stack trace that may provide more insight:

CypressError: cy.request() failed trying to load:

https://local.avoxi.com/

We attempted to make an http request to this URL but the request failed without a response.

We received this error at the network level:

  > Error: write EPROTO 4598932928:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure:../../vendor/node/deps/openssl/openssl/ssl/s23_clnt.c:802:

-----------------------------------------------------------

The request we sent was:

Method: GET
URL: https://local.avoxi.com/

-----------------------------------------------------------

Common situations why this would fail:
  - you don't have internet access
  - you forgot to run / boot your web server
  - your web server isn't accessible
  - you have weird network configuration settings on your computer

The stack trace for this error is:

RequestError: Error: write EPROTO 4598932928:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure:../../vendor/node/deps/openssl/openssl/ssl/s23_clnt.c:802:

    at new RequestError (/Users/patrick.alessi/Library/Caches/Cypress/3.3.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/request-promise-core/lib/errors.js:14:15)
    at Request.plumbing.callback (/Users/patrick.alessi/Library/Caches/Cypress/3.3.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/request-promise-core/lib/plumbing.js:87:29)
    at Request.RP$callback [as _callback] (/Users/patrick.alessi/Library/Caches/Cypress/3.3.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/request-promise-core/lib/plumbing.js:46:31)
    at self.callback (/Users/patrick.alessi/Library/Caches/Cypress/3.3.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/request/request.js:185:22)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at Request.onRequestError (/Users/patrick.alessi/Library/Caches/Cypress/3.3.1/Cypress.app/Contents/Resources/app/packages/server/node_modules/request/request.js:881:8)
    at emitOne (events.js:121:20)
    at ClientRequest.emit (events.js:211:7)
    at TLSSocket.socketErrorListener (_http_client.js:387:9)
    at emitOne (events.js:116:13)
    at TLSSocket.emit (events.js:211:7)
    at onwriteError (_stream_writable.js:408:12)
    at onwrite (_stream_writable.js:430:5)
    at _destroy (internal/streams/destroy.js:39:7)
    at TLSSocket.Socket._destroy (net.js:561:3)
    at TLSSocket.destroy (internal/streams/destroy.js:32:8)
    at WriteWrap.afterWrite (net.js:869:10)


Because this error occurred during a 'before each' hook we are skipping the remaining tests in the current suite: 'Smoke Test'

@flotwig
Copy link
Contributor Author

flotwig commented Jun 5, 2019

I believe we're experiencing this bug: nodejs/node#19359

This was introduced somewhere after Node 8.2.1 and fixed starting with Node 10.

Cypress 3.2.0 was pegged to 8.2.1, 3.3.0 upgraded it to 8.9.3 and so that's why you're seeing this issue now. #3568 will upgrade Node and fix this problem.

It might temporarily fix it for you to run Cypress with all SSL validation disabled, eg, NODE_TLS_REJECT_UNAUTHORIZED=0 cypress open

@flotwig flotwig added stage: awaiting external fix A 3rd party bug in Cypress - awaiting release and removed type: regression A bug that didn't appear until a specific Cy version release labels Jun 5, 2019
@PWAlessi
Copy link

PWAlessi commented Jun 5, 2019

Yep, I think so too. I saw that issue but I didn't investigate what version of node Cypress is using.

I tried running with NODE_TLS_REJECT_UNAUTHORIZED without success.

Thanks for your help!

@NickMele
Copy link

@flotwig I am currently running into this issue and I have exhausted all proposed solutions.

I have even installed the updated electron branch #4354 (comment) to see if it would resolve this issue, and it does not.

image

@epishev
Copy link

epishev commented Jul 25, 2019

Hi there! We are experiencing the same issue after updating cypress to 3.3.x. Do you have any solutions or workarounds? We are still using 3.2.0.
NODE_TLS_REJECT_UNAUTHORIZED=0 cypress run doesn't help.

@flotwig
Copy link
Contributor Author

flotwig commented Jul 29, 2019

@epishev It's pending on #3568, which is currently being worked on. Currently, you can test your site without HTTPS or try a different kind of self-signed certificate.

@cookiescrumbs
Copy link

If you have come here from Google because you've upgraded Cypress and have an Error:

 Error: write EPROTO 4777985472:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure:../../vendor/node/deps/openssl/openssl/ssl/s23_clnt.c:802:

Then rollback to version 3.2.0 and lock it down until the Cypress team sort the problem out.

@cypress-bot cypress-bot bot added stage: work in progress and removed stage: awaiting external fix A 3rd party bug in Cypress - awaiting release labels Aug 13, 2019
@ghost
Copy link

ghost commented Sep 2, 2019

Hi, some advanced about this..?

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

cypress-bot bot commented Sep 24, 2019

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

1 similar comment
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Sep 24, 2019

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

@NickMele
Copy link

NickMele commented Sep 25, 2019

Just tested out #4720 and it doesnt actually fix this issue.

Command:   visit
cypress_runner.js:174340 Error:     CypressError: cy.visit() failed trying to load:

....

We attempted to make an http request to this URL but the request failed without a response.

We received this error at the network level:

  > Error: write EPROTO 4449199552:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure:../../vendor/node/deps/openssl/openssl/ssl/s23_clnt.c:802:

Common situations why this would fail:
  - you don't have internet access
  - you forgot to run / boot your web server
  - your web server isn't accessible
  - you have weird network configuration settings on your computer

The stack trace for this error is:

Error: write EPROTO 4449199552:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure:../../vendor/node/deps/openssl/openssl/ssl/s23_clnt.c:802:

    at _errnoException (util.js:1024:11)
    at WriteWrap.afterWrite (net.js:867:14)

cc: @brian-mann

@flotwig
Copy link
Contributor Author

flotwig commented Sep 25, 2019

Hey @NickMele, those changes should fix it, since Node was updated to 12.0.0. Can you share the URL of a site that still fails or debug logs from the failure?

@NickMele
Copy link

NickMele commented Oct 2, 2019

@flotwig The URL is an internal dev url that we can only access on our VPN. Here are the logs with the issue still occurring after installing the latest build.

CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.0/darwin-x64/circle-develop-70b769c53a1c6128ca189ef8ec47551d767d7469-159180/cypress.zip
npm install https://cdn.cypress.io/beta/npm/3.5.0/circle-develop-70b769c53a1c6128ca189ef8ec47551d767d7469-159181/cypress.tgz --save-dev

https://gist.github.com/NickMele/56bb0953ad19a9198c740b3fec00eca9

@flotwig
Copy link
Contributor Author

flotwig commented Oct 2, 2019

@NickMele It's probably some bug with the SSL cipher you're using and Node 12. Can you share with me the commands you use to create the SSL certificate that is failing to verify? That will help me to reproduce the issue.

@jennifer-shehane jennifer-shehane added the type: regression A bug that didn't appear until a specific Cy version release label Oct 2, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 23, 2019

Released in 3.5.0.

@ghost
Copy link

ghost commented Oct 23, 2019

thaaaaaaaaaaaaaaaaanks a lot :) 👍

@zahraah98
Copy link

Hello, im on the latest cypress version
Still the issue is happening
visithttps://1mgr.qpay123.biz/v2/aoa
CypressError
cy.visit() failed trying to load:

https://1mgr.qpay123.biz/v2/aoa

We attempted to make an http request to this URL but the request failed without a response.

We received this error at the network level:

Error: write EPROTO 17004160:error:10000410:SSL routines:OPENSSL_internal:SSLV3_ALERT_HANDSHAKE_FAILURE:....\third_party\boringssl\src\ssl\tls_record.cc:592:SSL alert number 40

Common situations why this would fail:

  • you don't have internet access
  • you forgot to run / boot your web server
  • your web server isn't accessible
  • you have weird network configuration settings on your computer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: network type: regression A bug that didn't appear until a specific Cy version release
Projects
None yet
7 participants