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

Failure during cypress verify step --smoke-test / throwing at makeError #4624

Closed
jennifer-shehane opened this issue Jul 1, 2019 · 24 comments · Fixed by #4859
Closed

Failure during cypress verify step --smoke-test / throwing at makeError #4624

jennifer-shehane opened this issue Jul 1, 2019 · 24 comments · Fixed by #4859
Assignees
Labels
cli Epic Requires breaking up into smaller issues type: bug

Comments

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Jul 1, 2019

Current behavior:

We have a few issues floating around about errors during cypress verify that we have not been able to reproduce and have not been fixed as of Cypress v3.3.2.

This issue is the epic issue to track them all in one place. All the other issues have been closed and direct users to comment here.

The error looks something like this:

It looks like this is your first time using Cypress: xxx

 ✖  Verifying Cypress can run /Users/benjamin/Library/Caches/Cypress/xxx/Cypress.app
   → Cypress Version: xxx
Cypress failed to start.

This is usually caused by a missing library or dependency.

The error below should indicate which dependency is missing.

https://on.cypress.io/required-dependencies

If you are using Docker, we provide containers with all required dependencies installed.
----------

Command failed: /Caches/Cypress/xxx/Cypress.app/Contents/MacOS/Cypress --smoke-test --ping=584
----------

Platform: xxx
Cypress Version: xxx

Some of the output when run in DEBUG:cypress* mode display this stacktrace at makeError

cypress:cli needs XVFB? false +0ms
cypress:cli smoke test command: ../Cypress --smoke-test --ping=310 +0ms
cypress:cli Smoke test failed: { 
  Error: Command failed: ../Cypress --smoke-test --ping=310
    at makeError (../node_modules/execa/index.js:172:9)
    at Promise.all.then.arr (../node_modules/execa/index.js:277:16)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  code: 1,
  stdout: '',
  stderr: '',
  failed: true,
  signal: null,
  cmd: '../Cypress --smoke-test --ping=310',
  timedOut: false,
  killed: false 
} +43ms

Verifying Cypress can run /home/circleci/.cache/Cypress/3.1.5/Cypress [failed]

Most of the code values in this stack trace are either 1 or null.

Some people mentioned fixes?

Some people mentioned that restarting their computer fixed it. /shrug

Steps to reproduce: (app code and test code)

Basically any way you can run or open Cypress - people run into this issue

  • npx cypress open
  • cypress open
  • ./node_modules/cypress/bin/cypress open
  • yarn cypress run

Versions

Cypress Versions: 3.0.1 ~ 3.3.1
OS Versions:

  • darwin (18.2.0)
  • darwin (18.0.0)
  • darwin (17.6.0)
  • darwin (17.5.0)
  • macOS Mojave 10.14.3
  • Debian 9.6
  • linux (Debian - 9.8)
  • linux (Ubuntu Linux - 18.04)
  • win32 (6.3.9600)
  • win32 (10.0.17134)

Try this before commenting!

  • Update to the most recent version of Cypress: https://on.cypress.io/changelog
  • Clear your cache by running cypress cache clear
  • Try to run cypress verify BY ITSELF (not cypress open or cypress run)
  • Ensure dependencies are installed sudo apt-get install xvfb libgtk2.0-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2
@j-hoeppner
Copy link

j-hoeppner commented Jul 3, 2019

Hi together,
I had the same issue, but could fix it finally, but this might only apply to the people who in their logs have

timedOut: **true**,
killed: **true**

Workaround: adjust smoketest timeout per hand in node_modules\cypress\lib\tasks\verify.js
eg. smokeTestTimeout: 1500 to smokeTestTimeout: 100000

I guess it might be due to my AntiVirus or Company policy checks, that it takes much longer than the 1.5 seconds.

Feature-Suggestion (does not exist yet): Enabling smokeTestTimeout as an option for cypress verify like
npx cypress verify --smokeTestTimeout=100000

I hope this can help others.


Platform: win32 (10.0.15063)
Cypress Version: 3.3.2

@justinpincar
Copy link

justinpincar commented Jul 3, 2019

Is this option available on mac/linux? Tried both, same error.

➜  npx cypress verify --smokeTestTimeout=60000

  error: unknown option: --smokeTestTimeout


  Usage: verify [options]

  Verifies that Cypress is installed correctly and executable

  Options:

    --dev       runs cypress in development and bypasses binary check
    -h, --help  output usage information

➜  npx cypress --version
Cypress package version: 3.3.2
Cypress binary version: 3.3.2

@j-hoeppner
Copy link

@justinpincar the option does not exist yet, as far as I'm aware, this was a feature suggestion for the future by my side.
You actually have to go to the verify.js file under node_modules/cypress/lib/tasks and change it per hand in the file.

@justinpincar
Copy link

Ah, understood - I'll hack this change into our CI workflow and see if it helps.

@jennifer-shehane it would be great if Cypress exposed this option.

@jedwantstocode
Copy link

@justinpincar were you able to update your CI workflow to increase verify timeout?

Thanks

@justinpincar
Copy link

@jedwantstocode Only had it in for a few builds, but so far so good. For some reason my smoke test seems to take between 9s to 11s, resulting in sporadic timeouts with the default value of 10s. Haven't seen a failure to verify yet since adding this.

    - DEBUG=cypress:* npx cypress install
    - "sed -i.bak 's/smokeTestTimeout: 10000/smokeTestTimeout: 60000/' node_modules/cypress/lib/tasks/verify.js"
    - DEBUG=cypress:* npx cypress verify

Not a very robust solution, but better than flaky CI :-)

@kris4345
Copy link

kris4345 commented Jul 8, 2019 via email

@bahmutov
Copy link
Contributor

bahmutov commented Jul 8, 2019

@j-viczian where do you see timing out during cypress verify? Because we have increased the verify time out to 10 seconds in #4080

Could you paste the debug logs from the timed out verify, please?

@bc3
Copy link

bc3 commented Jul 16, 2019

hello, i had a sort-a-like problem, we were on the new 3.4.0 version, and our verify function got a timeout. What we did as WORK-A-ROUND, copied the file binary_state.json from the 3.2.0 version to the 3.4.0 folder and then cypress skips the verify function ... again not a solution, but it got us going again.

the content of this file is just:

{
"verified": true
}

@srideeps
Copy link

srideeps commented Jul 19, 2019

hi, we are seeing a similar problem after upgrading to 3.4.0. Our tests are running inside a Docker container. I see the following error.

Not so sure if this is a Cypress thing or a Docker issue while trying to verify it. Thanks for all the help!

It looks like this is your first time using Cypress: 3.4.0



[22:14:46]  Verifying Cypress can run /root/.cache/Cypress/3.4.0/Cypress [started]

[22:15:06]  Verifying Cypress can run /root/.cache/Cypress/3.4.0/Cypress [failed]

Cypress verification timed out.



This command failed with the following output:



/root/.cache/Cypress/3.4.0/Cypress/Cypress --smoke-test --ping=679



----------



Command failed: /root/.cache/Cypress/3.4.0/Cypress/Cypress --smoke-test --ping=679



----------



Platform: linux (Debian - 9.6)

Cypress Version: 3.4.0

Service 'cypress' failed to build: The command '/bin/sh -c ./node_modules/.bin/cypress verify' returned a non-zero code: 1

@bahmutov
Copy link
Contributor

Hi @srideeps
In order for us to track down this problem, please try installing Cypress with debug logs enabled and then paste the logs (as a code snippet). You can run Cypress install like this (I would also like to see XVFB records):

DEBUG=cypress:cli,xvfb npm install cypress

or on Windows

set DEBUG=cypress:cli,xvfb
npm install cypress

Also, in Docker container, could you do the ldd command to see if any dependencies are missing? https://docs.cypress.io/guides/guides/debugging.html#Run-the-Cypress-app-by-itself

@srideeps
Copy link

hi @bahmutov this issue got magically resolved the next time I ran it.
Thanks for providing debug options, will try for sure when I see it the next time.
Cheers to the Cypress team! 🥂

@VladimirKovalenko
Copy link

cy version 3.4.0
npm version 5.6
node version 8.10

Hello.

I face this issue on my TeamCity agents each time after cypress is updated by new version.
This issue isn't reproduced on my local env.
I would like to share information that I get and solution for my TeamCity configuration.
Maybe it would help to reproduce this issue and fix it globally.

Below you can find output with "set DEBUG=*" when verification is failed

image

I've checked 3 things with this issue

  1. Checked env var NODE_OPTIONS, NODE_ENV cause some people noted that verification timeout could be when there are some values. For me they are empty
    image

  2. cypress cache clear and cypress install helps perfectly each time, but I do not want to reinstall cypress for all my 5 TeamCity workers each time after update cypress.

  3. Increasing verification timeout from 10000 to 20000 is the best solution for me. In my case verification takes about 17 sec
    image

so I've added TeamCity build step where in PowerShell I patch verify.js file and it works for me

(Get-Content -path .\node_modules\cypress\lib\tasks\verify.js -Raw) -replace 'smokeTestTimeout: 10000','smokeTestTimeout: 20000' | Set-Content -Path .\node_modules\cypress\lib\tasks\verify.js

@msabramo
Copy link

msabramo commented Jul 26, 2019

I am running into this issue as well using the cypress/base:10 Docker image on a Jenkins server. I modified by build to set DEBUG=cypress:cli,xvfb and I collected the output here:

https://gist.github.com/msabramo/6730804bbd5ad7b8934eb0919a75f6f3

I hope this helps diagnose the issue!

@msabramo
Copy link

and here's the Dockerfile I'm using in case it helps:

https://gist.github.com/msabramo/2d5f18863db601e5ba6435f9405b9c63

@bahmutov
Copy link
Contributor

Thank you @msabramo for the detailed log and Dockerfile. I have built your Dockerfile locally and I can recreate the error IF I limit the CPU allocated to the container to a very small number. Here is my command (I commented out cypress verify command from the Docker built)

$ docker run --cpus=0.1 d480499238a7 npm run cypress:verify

> cypress-test-tiny@1.0.0 cypress:verify /usr/src/app
> cypress verify
...
2019-07-26T21:27:15.023Z cypress:cli smoke test command: /root/.cache/Cypress/3.4.0/Cypress/Cypress --smoke-test --ping=897
2019-07-26T21:27:25.527Z cypress:cli Smoke test failed: { Error: Command failed: /root/.cache/Cypress/3.4.0/Cypress/Cypress --smoke-test --ping=897


    at makeError (/usr/src/app/node_modules/cypress/node_modules/execa/index.js:172:9)
    at Promise.all.then.arr (/usr/src/app/node_modules/cypress/node_modules/execa/index.js:277:16)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  code: null,
  stdout: '',
  stderr: '',
  failed: true,
  signal: 'SIGTERM',
  cmd:
   '/root/.cache/Cypress/3.4.0/Cypress/Cypress --smoke-test --ping=897',
  timedOut: true,
  killed: true }
2019-07-26T21:27:25.527Z cypress:cli error message: Command failed: /root/.cache/Cypress/3.4.0/Cypress/Cypress --smoke-test --ping=897


2019-07-26T21:27:25.528Z cypress:cli error timedOut is true
2019-07-26T21:27:26.322Z cypress:cli Stopping Xvfb
2019-07-26T21:27:26.420Z xvfb restoring process.env.DISPLAY variable
2019-07-26T21:27:26.420Z xvfb lock filename /tmp/.X99-lock
2019-07-26T21:27:26.420Z xvfb lock file /tmp/.X99-lock
2019-07-26T21:27:26.930Z xvfb lock file /tmp/.X99-lock not found when stopping
[21:27:27]  Verifying Cypress can run /root/.cache/Cypress/3.4.0/Cypress [failed]
Cypress verification timed out.

This command failed with the following output:

/root/.cache/Cypress/3.4.0/Cypress/Cypress --smoke-test --ping=897

----------

Command failed: /root/.cache/Cypress/3.4.0/Cypress/Cypress --smoke-test --ping=897

----------

Platform: linux (Debian - 8.11)
Cypress Version: 3.4.0

which makes me suspect that in an underpowered container, verification should use a higher time limit. I could pass verification by increasing the timeout in the node_modules/cypress/lib/tasks/verify.js file, so we should probably bump this in our code by default.

@bahmutov bahmutov self-assigned this Jul 26, 2019
@cypress-bot cypress-bot bot added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: needs information Not enough info to reproduce the issue stage: work in progress labels Jul 29, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jul 29, 2019

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

@cypress-bot cypress-bot bot removed the stage: needs review The PR code is done & tested, needs review label Jul 29, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jul 29, 2019

Released in 3.4.1.

@tiborsaas-tw
Copy link

Problem still persists in 3.4.1

Platform: darwin (18.7.0)
Cypress Version: 3.4.1

@AngSin
Copy link

AngSin commented Sep 19, 2019

What worked for me in 3.4.1 was clearing the cache and re-installing:

npx cypress cache clear
npx cypress install
npx cypress open

@tiborsaas-tw
Copy link

@AngSin didn't work, I get the following error, I think it's different than it was. It's run as a pre-commit hook. Could that be an issue?

/Users/xx/Library/Caches/Cypress/3.4.1/Cypress.app/Contents/MacOS/Cypress: bad option: --run-project
npm ERR! code ELIFECYCLE
npm ERR! errno 9
npm ERR! [repo-name] test:cy: `cypress run`
npm ERR! Exit status 9

@seanlawrenz
Copy link

Can confirm, this issue is still happening with 3.4.1 even with clearing cache.

@kaiyoma
Copy link

kaiyoma commented Dec 10, 2019

We are running Cypress 3.7.0 and we see this problem periodically as well. We run Cypress in Docker containers as part of our CI and sometimes they may be underpowered, as has been noted in this issue. Unfortunately the logs don't really provide any color here:

15:51:06  [23:51:01]  Verifying Cypress can run /home/jenkins/.cache/Cypress/3.7.0/Cypress [started]
15:51:38  [23:51:35]  Verifying Cypress can run /home/jenkins/.cache/Cypress/3.7.0/Cypress [failed]

It would appear that 30 seconds is sometimes just not enough time. Is there some way we can set this timeout in our Cypress config? Or a way we can disable this test altogether? Either of these would be much more preferable than Cypress failing, which wastes a lot of our time because our tasks have to be restarted.

@jennifer-shehane
Copy link
Member Author

This issue will be closed to further comment as the exact issue here was resolved and tested.

If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix.

@cypress-io cypress-io locked as resolved and limited conversation to collaborators Jan 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cli Epic Requires breaking up into smaller issues type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.