[Bug?]: yarn 4: ssl3_read_bytes:sslv3 alert bad record
Self-service
- [ ] I'd be willing to implement a fix
Describe the bug
After update to yarn 4 from yarn 1, some packages are failed to install. The following error is displayed in the console:
❯ yarn add --dev jest
➤ YN0000: · Yarn 4.0.1
➤ YN0000: ┌ Resolution step
➤ YN0001: │ RequestError: 80E01B0002000000:error:0A0003FC:SSL routines:ssl3_read_bytes:sslv3 alert bad record mac:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1586:SSL alert number 20
at ClientRequest.<anonymous> (/Users/vrtischev/code/yarn-test/.yarn/releases/yarn-4.0.1.cjs:147:14258)
at Object.onceWrapper (node:events:629:26)
at ClientRequest.emit (node:events:526:35)
at u.emit (/Users/vrtischev/code/yarn-test/.yarn/releases/yarn-4.0.1.cjs:142:14420)
at TLSSocket.socketErrorListener (node:_http_client:495:9)
at TLSSocket.emit (node:events:514:28)
at TLSSocket._emitTLSError (node:_tls_wrap:1026:10)
at TLSWrap.onerror (node:_tls_wrap:482:11)
➤ YN0000: └ Completed in 1s 149ms
➤ YN0000: · Failed with errors in 1s 167ms
This does not happen with yarn 1 and other package managers.
To reproduce
- Create a new directory:
mkdir yarn-test,cd yarn-test -
yarn set version berry -
yarn add --dev jest - Error message appears
P.S. given link for Sherlock reproduction leads to a 404 page – https://yarnpkg.com/advanced/sherlock
Environment
System:
OS: macOS 13.6.1
CPU: (10) arm64 Apple M1 Pro
Binaries:
Node: 20.7.0 - /private/var/folders/s7/kg22gvp93xn0ydk1gyq7p2cw0000gp/T/xfs-2194da67/node
Yarn: 4.0.1 - /private/var/folders/s7/kg22gvp93xn0ydk1gyq7p2cw0000gp/T/xfs-2194da67/yarn
npm: 10.1.0 - ~/.nvm/versions/node/v20.7.0/bin/npm
Additional context
The error goes away if I do the following:
- Insall dependencies with npm first:
npm install --save-dev jest - Then remove
package-lock.json - Then install dependencies with yarn:
yarn
Updating yarn to 4.3.1 or 4.4.0 seemed to have fixed the issue for me.
I'm getting an error like this from time to time when trying to build Docker image:
1.613 ➤ YN0000: · Yarn 4.4.0
1.629 ➤ YN0000: ┌ Resolution step
1.860 ➤ YN0000: └ Completed in 0s 231ms
1.861 ➤ YN0000: ┌ Post-resolution validation
1.862 ➤ YN0086: │ Some peer dependencies are incorrectly met by dependencies; run yarn explain peer-requirements for details.
1.906 ➤ YN0000: └ Completed
1.907 ➤ YN0000: ┌ Fetch step
8.343 ➤ YN0001: │ RequestError: 10F2FFFFFF7F0000:error:0A0003FC:SSL routines:ssl3_read_bytes:sslv3 alert bad record mac:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1590:SSL alert number 20
8.343
8.343 at ClientRequest.<anonymous> (/faucet/.yarn/releases/yarn-4.4.0.cjs:147:14258)
8.343 at Object.onceWrapper (node:events:635:26)
8.343 at ClientRequest.emit (node:events:532:35)
8.343 at u.emit (/faucet/.yarn/releases/yarn-4.4.0.cjs:142:14855)
8.343 at emitErrorEvent (node:_http_client:103:11)
8.343 at TLSSocket.socketErrorListener (node:_http_client:506:5)
8.343 at TLSSocket.emit (node:events:520:28)
8.343 at TLSSocket._emitTLSError (node:_tls_wrap:1034:10)
8.343 at TLSWrap.onerror (node:_tls_wrap:475:11)
10.39 ➤ YN0000: └ Completed in 8s 480ms
10.39 ➤ YN0000: · Failed with errors in 8s 776ms
The error comes and goes though... Might get it four times in a row, and then not see it for couple of days
This is still experienced in 4.5.0, have not managed to test on Linux but on Windows I can get it pretty consistently. Cache cleaning seems to have no effect