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

[BUG] npm doesn't log intermediate fetch retry failures #7371

Closed
2 tasks done
hashtagchris opened this issue Apr 12, 2024 · 0 comments · Fixed by npm/make-fetch-happen#294
Closed
2 tasks done

[BUG] npm doesn't log intermediate fetch retry failures #7371

hashtagchris opened this issue Apr 12, 2024 · 0 comments · Fixed by npm/make-fetch-happen#294
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 10.x

Comments

@hashtagchris
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

npm retries idempotent read requests to the registry (ref). But it doesn't log the intermediate errors, regardless of loglevel.

Logging every http response or network failure would aid investigations. For example, if npm install is slow, it would useful to know why initial attempts failed, and how long individual http requests took.

Expected Behavior

Every http response or network failure is logged when the loglevel is verbose or higher.

Steps To Reproduce

Intentionally using https://httpbin.org for fault injection. When the supplied package name, 503, is appended to https://httpbin.org/status, that causes our "registry" to return a 503 status code, a retryable response.

  1. npm view 503 --loglevel silly --registry=https://httpbin.org/status --fetch-retries=2 (2 retries is the default)
  2. The command will fail with error 503 SERVICE UNAVAILABLE. That's expected.
  3. Inspect the log output. You'll see there were three attempts to retrieve package details, but only the final 503 http response is recorded. Log snippet:
31 silly logfile done cleaning log files
32 http fetch GET 503 https://httpbin.org/status/503 80700ms attempt #3 (cache skip)
33 timing command:view Completed in 80705ms
34 verbose stack HttpErrorGeneral: 503 SERVICE UNAVAILABLE - GET https://httpbin.org/status/503

Environment

  • npm: npm@10.5.2
  • Node.js: node@v20.12.2
  • OS Name: macOS 14.4.1
  • System Model Name: MacBook Air 15"
  • npm config:
; "user" config from /Users/hashtagchris/.npmrc

@npm:registry = "https://npm.pkg.github.com" 
//npm.pkg.github.com/:_authToken = (protected) 
//registry-sandbox.npm.red/:_authToken = (protected) 
//registry.npmjs.org/:_authToken = (protected) 
logs-max = 1000 

; node bin location = /Users/hashtagchris/.nvm/versions/node/v20.12.2/bin/node
; node version = v20.12.2
; npm local prefix = /Users/hashtagchris/r/npm
; npm version = 10.5.2
; cwd = /Users/hashtagchris/r/npm
; HOME = /Users/hashtagchris
; Run `npm config ls -l` to show all defaults.
@hashtagchris hashtagchris added Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x labels Apr 12, 2024
@wraithgar wraithgar added Priority 2 secondary priority issue and removed Needs Triage needs review for next steps labels Apr 12, 2024
wraithgar added a commit to npm/make-fetch-happen that referenced this issue Apr 30, 2024
Three commits:
- **deps: add proc-log@4.2.0**
- **fix: log errors on retry**
- **chore: fix linting in test files**

Closes npm/cli#7371
wraithgar added a commit to npm/make-fetch-happen that referenced this issue Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 10.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants