Open MikeMcC399 opened 1 month ago
Well, this was the originally coded behavior. I can't completely grasp while looking at this briefly why we would have a OR value of response.headers['content-length'])
here: https://github.com/cypress-io/cypress/blob/snyk-fix-7b3f6ffb824a82ccc3d6393cc519881c/cli/lib/tasks/download.js#L242
It's not failing verification though which makes me thing these values must be the same?
@jennifer-shehane
The verification is working correctly. It's only the one line of debug output which is wrong:
cypress:cli expected file size 82
As you say, it's the original behavior. The bug has been there unnoticed all the time going back to Cypress 10.
So, there are actually two issues:
1) Output of cypress:cli expected file size 82
where this is not a file size, just a content-length of a redirect response
2) When cypress install
is run locally (not in CI), the real data about file size e.g. expected file size 193682427
is overwritten by the Downloading Cypress 100%
outputs, which refreshes as the download progresses.
Here are the debug logs running in CI, where the file size is shown correctly cypress:cli expected file size 193682427
in addition to the previous line cypress:cli expected file size 82
related to the redirect:
$ CI=1 DEBUG=cypress:cli npx cypress install --force
cypress:cli NODE_OPTIONS is not set +0ms
cypress:cli parsed cli options { force: true } +137ms
cypress:cli installing with options {"force":true} +0ms
cypress:cli detecting arch { osPlatform: 'linux', osArch: 'x64' } +2ms
cypress:cli arm uname -m result: { stdout: 'x86_64' } +15ms
cypress:cli version in package.json is 13.14.2, version to install is 13.14.2 +16ms
cypress:cli Reading binary package.json from: /home/mike/.cache/Cypress/13.14.2/Cypress/resources/app/package.json +0ms
cypress:cli no binary installed under cli version +43ms
cypress:cli checking local file /home/mike/github/13.14.2 cwd /home/mike/github/tmp/test +1ms
cypress:cli Cypress already installed at /home/mike/.cache/Cypress/13.14.2 +0ms
cypress:cli but the installation was forced +0ms
cypress:cli preparing to download and unzip version 13.14.2 to path /home/mike/.cache/Cypress/13.14.2 +0ms
Installing Cypress (version: 13.14.2)
cypress:cli needed Cypress version: 13.14.2 +0ms
cypress:cli source url https://download.cypress.io/desktop/13.14.2?platform=linux&arch=x64 +0ms
cypress:cli downloading cypress.zip to "/tmp/cypress-6391.zip" +0ms
cypress:cli Downloading package {
url: 'https://download.cypress.io/desktop/13.14.2?platform=linux&arch=x64',
proxy: null,
downloadDestination: '/tmp/cypress-6391.zip'
} +1ms
cypress:cli expected file size 82 +275ms
cypress:cli redirect version: 13.14.2 +0ms
cypress:cli redirect url: https://cdn.cypress.io/desktop/13.14.2/linux-x64/cypress.zip +0ms
cypress:cli Downloading package {
url: 'https://cdn.cypress.io/desktop/13.14.2/linux-x64/cypress.zip',
proxy: null,
downloadDestination: '/tmp/cypress-6391.zip'
} +1ms
cypress:cli expected checksum c8379c3f09314e65117297938571f3dc357fb3a6d7797264b39e9905b5c357b3d37d3aae2acbbc8cc0a4f910c7b0d87e2de835b388d94713ddd9060c5b9fc56d +116ms
cypress:cli expected file size 193682427 +0ms
cypress:cli downloading finished +37s
cypress:cli verifying checksum and file size +0ms
cypress:cli downloaded file has the expected checksum and size ✅ +524ms
cypress:cli verified +4ms
cypress:cli finished downloading file: /tmp/cypress-6391.zip +38s
cypress:cli removing zip file /tmp/cypress-6391.zip +8s
You can now open Cypress by running one of the following, depending on your package manager:
- npx cypress open
- yarn cypress open
- pnpm cypress open
https://on.cypress.io/opening-the-app
Current behavior
Debug logs show
when installing the Cypress binary with
cypress install
.The file size of the Cypress binary is however
193682427
according toContent-Length
X-Amz-Meta-Size
Desired behavior
The debug logs should show the file size of the Cypress binary, not the Content-Length of the HTTP
302
redirect fromhttps://download.cypress.io/desktop/...
to
https://cdn.cypress.io/desktop/<version>/<platform>-<arch>/cypress.zip
Test code to reproduce
Cypress Version
13.14.2
Node version
v20.17.0
LTSOperating System
Ubuntu
22.04.5
LTSDebug Logs
Other
No response