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

OpenSSL errors when cached SSL certificates are corrupted #8705

Closed
flotwig opened this issue Sep 30, 2020 · 32 comments · Fixed by #17628
Closed

OpenSSL errors when cached SSL certificates are corrupted #8705

flotwig opened this issue Sep 30, 2020 · 32 comments · Fixed by #17628
Assignees
Labels
pkg/https-proxy This is due to an issue in the packages/https-proxy directory type: bug

Comments

@flotwig
Copy link
Contributor

flotwig commented Sep 30, 2020

Current behavior

There is a race condition in https-proxy that can cause the CA store to become corrupted if multiple Cypress processes are sharing the same appdata directory simultaneously. This causes errors like the following when visiting HTTPS websites:

Error: error:0b000074:X.509 certificate routines:OPENSSL_internal:KEY_VALUES_MISMATCH
Error: error:0900006e:PEM routines:OPENSSL_internal:NO_START_LINE

And other errors relating to corrupt/mismatched private keys and SSL certificates.

Desired behavior

The race condition is avoided, probably with the addition of a lockfile when generating/writing CA certificates.

Note: Cypress is not generally designed to run as multiple processes sharing a home directory.

Workaround (Linux-only)

A workaround is to set a different XDG_CONFIG_HOME environment variable for each Cypress process that is running. This will cause each process to have its own CA store, eliminating the possibility of a race condition.

Example:

# assuming these are somehow run simultaneously
XDG_CONFIG_HOME=/tmp/cyhome1 cypress run...
XDG_CONFIG_HOME=/tmp/cyhome2 cypress run...

This may have side-effects outside of just fixing this issue, but it is the only workaround for now.

@flotwig flotwig added type: unexpected behavior User expected result, but got another pkg/https-proxy This is due to an issue in the packages/https-proxy directory existing workaround labels Sep 30, 2020
@austinthiel
Copy link

Unfortunately, I still receive the error: Error: error:0900006e:PEM routines:OPENSSL_internal:NO_START_LINE when using the Linux workaround.

Context:

  • Running on a Jenkins pipeline (Linux Debian - 10) w/ Kubernetes containers
  • 6 parallel workers, run with the command XDG_HOME_DIR=/tmp/cyhome{1-6} yarn cypress run --browser chrome --parallel --record --env configFile=staging

Is my environment insufficient for the workaround?

@flotwig
Copy link
Contributor Author

flotwig commented Oct 5, 2020

@austinthiel hmm, that should fix it. Can you confirm that /tmp/cyhome*/Cypress/cy/production/proxy/certs contains certs for your domains? Check the output of ls /tmp/cyhome*/Cypress/cy/production/proxy/certs - you should see 6 folders, each with a .pem for the intercepted HTTPS domains.

@xtroncode
Copy link

I am facing the same issue. I tried the work around but the directories /tmp/cyhome* are not being created at all. Do we have to create them manually ?

@flotwig
Copy link
Contributor Author

flotwig commented Nov 2, 2020

Cypress will create the directories for you, how are you setting the environment variable?

@xtroncode
Copy link

inline
XDG_HOME_DIR=/tmp/cyhome1 DISPLAY=:99 cypress run --browser /usr/bin/google-chrome --headless --record --key **** --parallel --group ...

@kpiotr
Copy link

kpiotr commented Nov 3, 2020

@flotwig I got super excited when I saw this issue, you described exactly the problem that has been failing some of our runs for months!

However, the workaround with setting XDG_HOME_DIR didn't fix anything for us either. After knowing what's the source of the problem (certs race condition) I got to digging through cypress code and found that setting CYPRESS_KONFIG_ENV does the job and creates a separate directory for each process. We are on v5.4 BTW

https://github.com/cypress-io/cypress/blob/v5.4.0/packages/server/lib/util/app_data.js#L95

This might be an internal cypress env, but I will give it a go anyway.

@jmhuddle4
Copy link

jmhuddle4 commented Nov 5, 2020

I also get this SSL error when trying to run tests in parallel about 90% of the time
The workaround with setting XDG_HOME_DIR didn't work for us
If I set CYPRESS_KONFIG_ENV then I run into this issue -> #5053

Here is a snippet of our Jenkisfile:

pipeline {
  agent {
    docker {
      image 'cypress/base:10'
      args '-u root --ipc=host'
    }
  }

  stages {
    stage('build') {
      steps {
        echo "installing cypress..."
        sh 'npm install cypress'
      }
    }

   stage('cypress parallel tests') {
        environment {
           CYPRESS_RECORD_KEY = credentials('cypress-record-key-poc')
           CYPRESS_trashAssetsBeforeRuns = 'false'
         }

      parallel {
        stage('tester A') {
          steps {
            echo "Running build A"
            sh "XDG_HOME_DIR=/tmp/cyhome1 npx cypress run --record --config baseUrl=${TEST_URL} --group=Jenkinsfile-cypress-test --parallel --ci-build-id=${BUILD_ID}"
          }
        }

        // second tester runs the same command
        stage('tester B') {
          steps {
            echo "Running build B"
            sh "XDG_HOME_DIR=/tmp/cyhome2 npx cypress run --record --config baseUrl=${TEST_URL} --group=Jenkinsfile-cypress-test --parallel --ci-build-id=${BUILD_ID}"
          }
        }
      }
    }
  }
}

@kalebdf
Copy link

kalebdf commented Nov 5, 2020

We are running Cypress in Google Cloud Build with parallelization through separate steps (which are docker containers that share disk volume mounts). We also ran into this same error: Error: error:0900006e:PEM routines:OPENSSL_internal:NO_START_LINE - ERR_OSSL_PEM_NO_START_LINE.

We set the environment variable suggested XDG_HOME_DIR=/tmp/cyhome1...(2,3,4, etc.); however, it did not resolve the issue for us. Any other suggestions?

@flotwig
Copy link
Contributor Author

flotwig commented Nov 5, 2020

Wow, ok, thanks to @CypressHarry I realize now that the env var for the workaround is NOT XDG_HOME_DIR as I originally posted, it is actually XDG_CONFIG_HOME. So the workaround is actually:

# assuming these are somehow run simultaneously
XDG_CONFIG_HOME=/tmp/cyhome1 cypress run...
XDG_CONFIG_HOME=/tmp/cyhome2 cypress run...

My bad 😅

@jmhuddle4
Copy link

Thank you @flotwig that worked! 🎉

@sandeepthukral
Copy link

@flotwig it indeed seems to be working. Ran our pipelines a few times and it works. But will keep an eye on this for the coming weeks

@gururajhm
Copy link

@here, can anyone help me too facing same issue. how to set this <XDG_CONFIG_HOME=/tmp/cyhome1 cypress run...>
what happens if we set to chrome1,2,3 etc.. is that will pick all the tests and run for each config or it divides the tests between each run.

at the moment I tried in my local by running % XDG_CONFIG_HOME=/tmp/cyhome2 npm run e2e
and that worked.

@sandeepthukral
Copy link

@gururajhm this is required when you are trying to execute tests in parallel. Add XDG_CONFIG_HOME env var before you run cypress. Give a different folder for each parallel execution.

@gururajhm
Copy link

Thanks @sandeepthukral as I am not using cypress with parllel test so tried with XDG_CONFIG_HOME=/tmp/cyhome1 npm run e2e and that worked in CircleCI.

@jennifer-shehane
Copy link
Member

We don't suggest ever setting CYPRESS_KONFIG_ENV. This is a reserved environment variable and only used internally. Unintended things will happen with your runs.

@ts-23
Copy link

ts-23 commented Jan 12, 2021

We are getting the same Error: error:0900006e:PEM routines:OPENSSL_internal:NO_START_LINE but from a different cause.

When Cypress attempts to download an image from with this particular URL:

https://this.is.redacted/dZwzZ14GPsBH_TXH_tn_4x3.png?Expires=1610410453&Signature=KDUkCYlolkkMKOM0csAFBg~phdcbR8KnkL7M-RoyZspDSRLq86ZlFgW1quFF5FeJbBCQ3d7VfUVKit8uGuzDV3OqMpK-iTjg6cakgl7omJsk-0ihqvYbWiE1ZUXpyVXjPD7Rgy258ZSXcUuBbA26lwh33xCS4SH4y6WUCCM6D4QSzHFHbFymtlaMV4-mzoU9UclMXANbWA55My-4C2ycNG7fnSBCCMJKarQW8HQHaiVaQh7eB5g55KWW2cl0fgaTvh1EkruGb3neGSyL2saIiPKCtV0RVlBVy9S0uLrrCEctwDx4~NvgToPIASDyzZbOcYFQZqEuF5leM-BQY7O-JA__&Key-Pair-Id=APKAJMOP6VFMPPEMQEVQ

we have the error in \AppData\Local\Cypress\Cache\6.2.1\Cypress\resources\app\packages\https-proxy\lib\server.js:227:23

and the .pem file for relevant hostname is empty in the folder \AppData\Roaming\Cypress\cy\production\proxy\certs

Windows 10
Cypress 6.2.1
Chrome 87

@flotwig
Copy link
Contributor Author

flotwig commented Jan 13, 2021

@ts-23 that is the same issue as the OP. Unless you are saying you have no other Cypress processes running?

@ts-23
Copy link

ts-23 commented Jan 13, 2021

@ts-23 that is the same issue as the OP. Unless you are saying you have no other Cypress processes running?

Yes @flotwig, that is correct there was only one Cypress process running.

@KarKarbI4
Copy link

KarKarbI4 commented Feb 3, 2021

@ts-23 I've experienced same problem, and after I cleared cypress app data as mentioned in Troubleshooting guide, problem gone :)
https://docs.cypress.io/guides/references/troubleshooting.html#To-clear-App-Data

@MasonM
Copy link

MasonM commented Mar 29, 2021

Unfortunately, the XDG_CONFIG_HOME workaround doesn't work if you use the cypress.run() API. Although the API accepts an env option with environment variables, those variables aren't actually set as OS-level environment variables, so doing something like this has no effect:

cypress.run({
  // Doesn't work
  env: { XDG_CONFIG_HOME: '/tmp/foo' }
});

Downgrading from version 5.6.0 to 5.1.0 fixed it for us. Judging by the other bug reports, this issue must have been introduced between versions 5.1.0 and 5.4.0. Here's a full backtrace from version 5.6.0, in case it's helpful:

12:30:57 Error: error:0900006e:PEM routines:OPENSSL_internal:NO_START_LINE
12:30:57     at Object.createSecureContext (_tls_common.js:129:17)
12:30:57     at Server.addContext (_tls_wrap.js:1407:32)
12:30:57     at /root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/lib/server.js:222:23
12:30:57     at tryCatcher (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/util.js:16:23)
12:30:57     at Promise._settlePromiseFromHandler (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:512:31)
12:30:57     at Promise._settlePromise (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:569:18)
12:30:57     at Promise._settlePromise0 (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:614:10)
12:30:57     at Promise._settlePromises (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:694:18)
12:30:57     at Promise._fulfill (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:638:18)
12:30:57     at Promise._settlePromise (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:582:21)
12:30:57     at Promise._settlePromise0 (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:614:10)
12:30:57     at Promise._settlePromises (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:694:18)
12:30:57     at Promise._fulfill (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:638:18)
12:30:57     at Promise._resolveCallback (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:432:57)
12:30:57     at Promise._settlePromiseFromHandler (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:524:17)
12:30:57     at Promise._settlePromise (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:569:18)
12:30:57     at Promise._settlePromise0 (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:614:10)
12:30:57     at Promise._settlePromises (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:694:18)
12:30:57     at Promise._fulfill (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:638:18)
12:30:57     at PromiseArray._resolve (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise_array.js:126:19)
12:30:57     at PromiseArray._promiseFulfilled (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise_array.js:144:14)
12:30:57     at PromiseArray._iterate (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise_array.js:114:31)
12:30:57     at PromiseArray.init [as _init] (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise_array.js:78:10)
12:30:57     at Promise._settlePromise (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:566:21)
12:30:57     at Promise._settlePromise0 (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:614:10)
12:30:57     at Promise._settlePromises (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:694:18)
12:30:57     at Promise._fulfill (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:638:18)
12:30:57     at PromiseArray._resolve (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise_array.js:126:19)
12:30:57     at PromiseArray._promiseFulfilled (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise_array.js:144:14)
12:30:57     at Promise._settlePromise (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:574:26)
12:30:57     at Promise._settlePromise0 (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:614:10)
12:30:57     at Promise._settlePromises (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:694:18)
12:30:57     at _drainQueueStep (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/async.js:138:12)
12:30:57     at _drainQueue (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/async.js:131:9)
12:30:57     at Async._drainQueues (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/async.js:147:5)
12:30:57     at Immediate.Async.drainQueues [as _onImmediate] (/root/.cache/Cypress/5.6.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/async.js:17:14)
12:30:57     at processImmediate (internal/timers.js:456:21)
12:30:57  {
12:30:57   library: 'PEM routines',
12:30:57   function: 'OPENSSL_internal',
12:30:57   reason: 'NO_START_LINE',
12:30:57   code: 'ERR_OSSL_PEM_NO_START_LINE'
12:30:57 }

@Sam152
Copy link

Sam152 commented May 6, 2021

@MasonM

I ran into this issue running cypress on OSX. In my case the fix was as follows:

  1. Navigate into the directory cypress stores it's proxy certificates. In my case this folder was located here:
cd ~/Library/Application\ Support/Cypress/cy/production/proxy/
  1. Within this folder, there is certs and keys, both have files with a list of domains accessed during cypress tests. In my case the final two files in each folder were empty:
~#: ls -lah key
total 240
...
-rw-r--r--   1 sam  staff     0B  6 May 16:40 www.google-analytics.com.key
-rw-r--r--   1 sam  staff     0B  6 May 16:40 www.google-analytics.com.public.key

~#: ls -lah certs
total 120
...
-rw-r--r--   1 sam  staff     0B  6 May 13:27 www.google-analytics.com.pem
-rw-r--r--   1 sam  staff     0B  6 May 13:27 www.googletagmanager.com.pem
  1. I'm not sure why these .pem and .key files were empty for a handful of domains, but deleting them and rerunning a cypress test successfully regenerated them as non-empty and the tests started to pass.

@flotwig
Copy link
Contributor Author

flotwig commented May 6, 2021

I'm not sure why these .pem and .key files were empty for a handful of domains, but deleting them and rerunning a cypress test successfully regenerated them as non-empty and the tests started to pass.

Cypress should probably have better error handling, it sounds like Cypress exited in the middle of a HTTPS visit or something and left these files empty, but there's no reason it can't gracefully handle errors here...

@Sam152
Copy link

Sam152 commented May 6, 2021

Agreed, it would be great if cypress handled this case better.

@wrslatz
Copy link

wrslatz commented Jun 4, 2021

We're seeing this (and cypress-io/cypress-docker-images#54, though we have a workaround) when running a few Cypress tests back to back (not parallel). A test in the middle will randomly fail with the routines:OPENSSL_internal:NO_START_LINE. The prior test passed, from what I can tell, so not exactly sure what is causing this corruption.

I'm trying to see if setting a different XDG_CONFIG_HOME for each group of Cypress tests (we run a few serially against each environment) helps.

@adrian861
Copy link

This is still occurring, and when it happens, Cypress Dashboard is not recognizing that there was a failure, so the spec it occurred for will appear to continue running after the CI job has completed. We are using Cypress docker image 7.3.0, parallelization on two Jenkins docker nodes.

Something that may be of interest to others, we did not see this issue until we reduced our Run Completion Delay under the Project Settings to one second in an attempt to shorten run time. Output for the error:

Error: error:0900006e:PEM routines:OPENSSL_internal:NO_START_LINE
10:38:18      at Object.createSecureContext (_tls_common.js:129:17)
10:38:18      at Server.addContext (_tls_wrap.js:1420:32)
10:38:18      at /root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/lib/server.js:222:23
10:38:18      at tryCatcher (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/util.js:16:23)
10:38:18      at Promise._settlePromiseFromHandler (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:512:31)
10:38:18      at Promise._settlePromise (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:569:18)
10:38:18      at Promise._settlePromise0 (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:614:10)
10:38:18      at Promise._settlePromises (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:694:18)
10:38:18      at Promise._fulfill (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:638:18)
10:38:18      at Promise._settlePromise (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:582:21)
10:38:18      at Promise._settlePromise0 (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:614:10)
10:38:18      at Promise._settlePromises (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:694:18)
10:38:18      at Promise._fulfill (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:638:18)
10:38:18      at Promise._resolveCallback (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:432:57)
10:38:18      at Promise._settlePromiseFromHandler (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:524:17)
10:38:18      at Promise._settlePromise (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:569:18)
10:38:18      at Promise._settlePromise0 (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:614:10)
10:38:18      at Promise._settlePromises (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:694:18)
10:38:18      at Promise._fulfill (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:638:18)
10:38:18      at PromiseArray._resolve (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise_array.js:126:19)
10:38:18      at PromiseArray._promiseFulfilled (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise_array.js:144:14)
10:38:18      at PromiseArray._iterate (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise_array.js:114:31)
10:38:18      at PromiseArray.init [as _init] (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise_array.js:78:10)
10:38:18      at Promise._settlePromise (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:566:21)
10:38:18      at Promise._settlePromise0 (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:614:10)
10:38:18      at Promise._settlePromises (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:694:18)
10:38:18      at Promise._fulfill (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:638:18)
10:38:18      at PromiseArray._resolve (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise_array.js:126:19)
10:38:18      at PromiseArray._promiseFulfilled (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise_array.js:144:14)
10:38:18      at Promise._settlePromise (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:574:26)
10:38:18      at Promise._settlePromise0 (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:614:10)
10:38:18      at Promise._settlePromises (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:694:18)
10:38:18      at _drainQueueStep (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/async.js:138:12)
10:38:18      at _drainQueue (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/async.js:131:9)
10:38:18      at Async._drainQueues (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/async.js:147:5)
10:38:18      at Immediate.Async.drainQueues [as _onImmediate] (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/async.js:17:14)
10:38:18      at processImmediate (internal/timers.js:461:21)
10:38:18   {
10:38:18    library: 'PEM routines',
10:38:18    function: 'OPENSSL_internal',
10:38:18    reason: 'NO_START_LINE',
10:38:18    code: 'ERR_OSSL_PEM_NO_START_LINE'
10:38:18  }
10:38:18  Error: error:0900006e:PEM routines:OPENSSL_internal:NO_START_LINE
10:38:18      at Object.createSecureContext (_tls_common.js:129:17)
10:38:18      at Server.addContext (_tls_wrap.js:1420:32)
10:38:18      at /root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/lib/server.js:222:23
10:38:18      at tryCatcher (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/util.js:16:23)
10:38:18      at Promise._settlePromiseFromHandler (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:512:31)
10:38:18      at Promise._settlePromise (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:569:18)
10:38:18      at Promise._settlePromise0 (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:614:10)
10:38:18      at Promise._settlePromises (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:694:18)
10:38:18      at Promise._fulfill (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:638:18)
10:38:18      at Promise._settlePromise (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:582:21)
10:38:18      at Promise._settlePromise0 (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:614:10)
10:38:18      at Promise._settlePromises (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:694:18)
10:38:18      at Promise._fulfill (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:638:18)
10:38:18      at Promise._resolveCallback (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:432:57)
10:38:18      at Promise._settlePromiseFromHandler (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:524:17)
10:38:18      at Promise._settlePromise (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:569:18)
10:38:18      at Promise._settlePromise0 (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:614:10)
10:38:18      at Promise._settlePromises (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:694:18)
10:38:18      at Promise._fulfill (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:638:18)
10:38:18      at PromiseArray._resolve (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise_array.js:126:19)
10:38:18      at PromiseArray._promiseFulfilled (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise_array.js:144:14)
10:38:18      at PromiseArray._iterate (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise_array.js:114:31)
10:38:18      at PromiseArray.init [as _init] (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise_array.js:78:10)
10:38:18      at Promise._settlePromise (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:566:21)
10:38:18      at Promise._settlePromise0 (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:614:10)
10:38:18      at Promise._settlePromises (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:694:18)
10:38:18      at Promise._fulfill (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:638:18)
10:38:18      at PromiseArray._resolve (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise_array.js:126:19)
10:38:18      at PromiseArray._promiseFulfilled (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise_array.js:144:14)
10:38:18      at Promise._settlePromise (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:574:26)
10:38:18      at Promise._settlePromise0 (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:614:10)
10:38:18      at Promise._settlePromises (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/promise.js:694:18)
10:38:18      at _drainQueueStep (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/async.js:138:12)
10:38:18      at _drainQueue (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/async.js:131:9)
10:38:18      at Async._drainQueues (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/async.js:147:5)
10:38:18      at Immediate.Async.drainQueues [as _onImmediate] (/root/.cache/Cypress/7.3.0/Cypress/resources/app/packages/https-proxy/node_modules/bluebird/js/release/async.js:17:14)
10:38:18      at processImmediate (internal/timers.js:461:21)

@adrian861
Copy link

@flotwig @jennifer-shehane Does this issue really have a work-around? Seems like the one that works for most people is changing an internal config value that shouldn't be changed.

@flotwig
Copy link
Contributor Author

flotwig commented Jun 9, 2021

@adrian861 I think you're right, the workaround is hacky and plus it does not fix this for everyone all the time, so this warrants further investigation. Especially since this issue seems to occur even with 1 Cypress process running sometimes, and even in CI.

The solution would be to add error handling in https-proxy where it calls addContext so it can recover appropriately if the SSL cert cached on disk is corrupted.

@flotwig flotwig added type: bug and removed existing workaround type: unexpected behavior User expected result, but got another labels Jun 9, 2021
@flotwig flotwig changed the title OpenSSL errors when running multiple Cypress processes simultaneously OpenSSL errors when cached SSL certificates are corrupted Jun 9, 2021
@jennifer-shehane
Copy link
Member

@Francllin
Copy link

Hey guys! do we have a fixed solution for this problem?; here I am still having the same problem dictated by you.

@kpiotr
Copy link

kpiotr commented Jun 14, 2021

Setting CYPRESS_KONFIG_ENV node env to a unique string for each cypress process running on the machine solves the problem.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 9, 2021

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

@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Aug 9, 2021
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 16, 2021

Released in 8.3.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v8.3.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Aug 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pkg/https-proxy This is due to an issue in the packages/https-proxy directory type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.