Yarn install is failing with network connection issue from today

We are suddenly getting the following error –

yarn install v1.22.10
info No lockfile found.
[1/4] :mag: Resolving packages…
info There appears to be trouble with your network connection. Retrying…
info There appears to be trouble with your network connection. Retrying…
info There appears to be trouble with your network connection. Retrying…
info There appears to be trouble with your network connection. Retrying…
error An unexpected error occurred: “https://aws-amplify/%2Fpushnotification: getaddrinfo ENOTFOUND aws-amplify”.
info If you think this is a bug, please open a bug report with the information provided in “/Users/distiller/project/gethai-app/yarn-error.log”.
info Visit yarn install | Yarn for documentation about this command.
Exited with code exit status 1’

Inorder to resolve this, I tried out a few changes like

  • added a network timeout for yarn install
  • removed / deleted the yarn.lock

But, none of these help. It started suddenly from today. There was no change config.yml file as compared to yesterday when it was working.

The error also occurs in my builds this days.
My last successful build was on March 24, 2023.
Since then, I cannot successfully build a single build with yarn.

I did the same workarounds:

  • increase the network timeout for yarn
  • remove/delete the yarn.lock file

[linux/arm64 stage-2 10/19] RUN apk --no-cache --virtual yarn-dependencies add yarn && yarn global add --no-progress --network-timeout 600000 puppeteer @mermaid-js/mermaid-cli mscgenjs-cli bpmn-js-cmd bytefield-svg nomnoml state-machine-cat && rm -f /usr/local/share/.config/yarn/global/yarn.lock && yarn install --no-lockfile --network-timeout 600000:
#71 173.9 info There appears to be trouble with your network connection. Retrying…
#71 177.3 info There appears to be trouble with your network connection. Retrying…
#71 180.9 info There appears to be trouble with your network connection. Retrying…
#71 186.8 info There appears to be trouble with your network connection. Retrying…
#71 211.9 info There appears to be trouble with your network connection. Retrying…
#71 216.3 info There appears to be trouble with your network connection. Retrying…
#71 235.3 error An unexpected error occurred: “https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-19.8.0.tgz: ESOCKETTIMEDOUT”.
#71 235.3 info If you think this is a bug, please open a bug report with the information provided in “/usr/local/share/.config/yarn/global/yarn-error.log”.

@dev-gethai have you, and if so, how, solved the problem?

Apparently the underlying issue has been known for more than 2.5 years, but there are no solutions so far: yarnpkg/yarn#8242 .
It’s not a network issue at all, caused by IO latency instead.

In my case I use a combined yarn add ... with several packages and a single yarn install:

I fix this by split this in several yarn add ... and yarn install ... steps.