npm / rfcs

Public change requests/proposals & ideation
Other
726 stars 238 forks source link

Add Logging for Http Redirects to Package Content #762

Open magleaso opened 5 months ago

magleaso commented 5 months ago

Npm does not log a line for http redirects on package download, so it is not possible to determine whether failures occur before or after being redirected to make a second request.

Azure Artifacts for example responds with a 303 redirect to Azure blob storage when npm requests a tgz file. If npm were to log a line with a 303 redirect and then another line for the subsequent request to storage, this would significantly improve debugging and allow users to determine if they are having connectivity/availability issues with the package repository or the underlying storage that is getting redirected to.

Example failure that cannot differentiate whether package repo or storage failed:

npm ERR! code ETIMEDOUT npm ERR! errno ETIMEDOUT npm ERR! network request to https://pkgs.dev.azure.com/myOrg/project/_packaging/myPackageFeed/npm/registry/ansi-regex/-/ansi-regex-4.2.0.tgz failed, reason: npm ERR! network This is a problem related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config'