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

Log retries #294

Merged
merged 3 commits into from
Apr 30, 2024
Merged

Log retries #294

merged 3 commits into from
Apr 30, 2024

Conversation

wraithgar
Copy link
Member

@wraithgar wraithgar commented Apr 30, 2024

Three commits:

Closes npm/cli#7371

@wraithgar wraithgar requested a review from a team as a code owner April 30, 2024 06:51
@wraithgar
Copy link
Member Author

This technically logs one extra "retrying" because it doesn't know if the retry module is going to actually retry or give up at this point.

@wraithgar
Copy link
Member Author

wraithgar commented Apr 30, 2024

$ node . view 503 --loglevel verbose --registry=https://httpbin.org/status --fetch-retries=1
npm verbose cli /Users/wraithgar/.nvm/versions/node/v22.0.0/bin/node /Users/wraithgar/Development/npm/cli/branches/gar_fetch-retries
npm info using [email protected]
npm info using [email protected]
npm verbose title npm view 503
npm verbose argv "view" "503" "--loglevel" "verbose" "--registry" "https://httpbin.org/status" "--fetch-retries" "1"
npm verbose logfile logs-max:10 dir:/Users/wraithgar/.npm/_logs/2024-04-30T14_19_47_652Z-
npm verbose logfile /Users/wraithgar/.npm/_logs/2024-04-30T14_19_47_652Z-debug-0.log
npm http fetch GET https://httpbin.org/status/503 attempt 1 failed with 503
npm http fetch GET https://httpbin.org/status/503 attempt 2 failed with 503
npm http fetch GET 503 https://httpbin.org/status/503 10505ms attempt #2 (cache skip)
npm verbose stack HttpErrorGeneral: 503 SERVICE UNAVAILABLE - GET https://httpbin.org/status/503
npm verbose stack     at /Users/wraithgar/Development/npm/cli/branches/gar_fetch-retries/node_modules/npm-registry-fetch/lib/check-response.js:95:15
npm verbose stack     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
npm verbose stack     at async RegistryFetcher.packument (/Users/wraithgar/Development/npm/cli/branches/gar_fetch-retries/node_modules/pacote/lib/registry.js:91:19)
npm verbose stack     at async View.getData (/Users/wraithgar/Development/npm/cli/branches/gar_fetch-retries/lib/commands/view.js:193:20)
npm verbose stack     at async View.exec (/Users/wraithgar/Development/npm/cli/branches/gar_fetch-retries/lib/commands/view.js:104:28)
npm verbose stack     at async module.exports (/Users/wraithgar/Development/npm/cli/branches/gar_fetch-retries/lib/cli/entry.js:74:5)
npm verbose statusCode 503
npm verbose pkgid 503@*
npm verbose cwd /Users/wraithgar/Development/npm/cli/branches/gar_fetch-retries
npm verbose Darwin 23.4.0
npm verbose node v22.0.0
npm verbose npm  v10.6.0
npm error code E503
npm error 503 SERVICE UNAVAILABLE - GET https://httpbin.org/status/503
npm verbose exit 1
npm verbose code 1

npm error A complete log of this run can be found in: /Users/wraithgar/.npm/_logs/2024-04-30T14_19_47_652Z-debug-0.log

karenjli
karenjli previously approved these changes Apr 30, 2024
@wraithgar
Copy link
Member Author

Reworded it to just list the retry number if it is a retriable request.

Copy link

@hashtagchris hashtagchris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for adding this logging! This will make investigating transient registry errors much easier.

@wraithgar wraithgar merged commit 5aaa412 into main Apr 30, 2024
20 checks passed
@wraithgar wraithgar deleted the gar/log-retries branch April 30, 2024 14:40
@wraithgar wraithgar restored the gar/log-retries branch April 30, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] npm doesn't log intermediate fetch retry failures
3 participants