[BUG] Log failed GET attempts without having to change log level
Is there an existing issue for this?
- [x] I have searched the existing issues
This issue exists in the latest npm version
- [x] I am using the latest npm
Current Behavior
The registry is down at the moment, but when you run npm install, it just hangs forever without giving any indication that something is going wrong.
When I run npm --loglevel verbose install, I suddenly see that there are failed queries, and only then proceed to check https://status.npmjs.org/ to see that there is a registry issue.
This is not really helpful for most people, and you have to know this --loglevel flag to even begin to understand why nothing is happening in your terminal.
Here are some of the logs that I see when using verbose:
npm http fetch GET https://registry.npmjs.org/@turbo%2fworkspaces attempt 1 failed with 504
npm http fetch GET https://registry.npmjs.org/@turbo%2fworkspaces attempt 2 failed with 504
npm http fetch GET https://registry.npmjs.org/@turbo%2fworkspaces attempt 3 failed with 504
npm http fetch GET 504 https://registry.npmjs.org/@turbo%2fworkspaces 122114ms attempt #3 (cache skip)
It would seem normal to me to alert the developer that his npm install command is hitting 5xx errors without having to change log levels.
Expected Behavior
I expect to see failed GET requests as info or error logs, and not verbose.
Steps To Reproduce
No response
Environment
- npm: 10.8.2
- Node.js: 20.18.1
- OS Name: macOS
The npm registry is currently down, check https://status.npmjs.org/ for when it will be resolved.
I know the registry is down, are you sure you read the full description of my issue? I'd like to suggest showing failed GET requests without changing loglevel, which I consider as a bug.
@Floriferous gotcha, yeah it's pretty slow to error because it retries by default 3x, what would you want here?
Yeah, waiting 120 seconds before you get an insight into why the install is slow is not great.
My initial thought is that I assume retries are rare enough, that you can just log any failed attempt when using a regular log level. Any failed request could be logged, and it's actually nice to see that npm is doing multiple attempts.
Maybe you have some metrics on this, but I'm guessing it doesn't happen often enough that it wouldn't pollute anyone.