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

yarn doesn't properly report http errors when fetching packages #6735

Open
arcanis opened this issue Nov 28, 2018 · 3 comments
Open

yarn doesn't properly report http errors when fetching packages #6735

arcanis opened this issue Nov 28, 2018 · 3 comments
Assignees

Comments

@arcanis
Copy link
Member

arcanis commented Nov 28, 2018

Do you want to request a feature or report a bug?
bug

What is the current behavior?
When an HTTP request for a tarball fails with a non-200 exit code (like 401 or 500), Yarn doesn't seem to properly catch it. This cause the error response to be treated as the tarball, which cause invalid reporting (usually "unexpected end of archive").

Also see:
This is the part of the code that's affected:
https://github.com/yarnpkg/yarn/blob/master/src/fetchers/tarball-fetcher.js#L231-L243

We provide a process option, so we never set the callback function that usually catch non-200 exit code:
https://github.com/yarnpkg/yarn/blob/master/src/util/request-manager.js#L407

If the current behavior is a bug, please provide the steps to reproduce.
It happens randomly based on the npm registry flakiness.

What is the expected behavior?
The error should say something like "Received an HTTP 500 from the server".

Please mention your node.js, yarn and operating system version.
1.12.3

@ghost ghost assigned arcanis Nov 28, 2018
@ghost ghost added the triaged label Nov 28, 2018
@MLoughry
Copy link

Please fix this. Our team uses a private npm registry, and devs constantly get confused when their creds expire because the error messages are complete nonsense.

@arcanis
Copy link
Member Author

arcanis commented Jan 17, 2019

@MLoughry have you tried the 1.13? I believe this issue should have been fixed with #6817

@MLoughry
Copy link

It's better, I suppose.

error An unexpected error occurred: "https://outlookweb.pkgs.visualstudio.com/_packaging/owa-npm/npm/registry/@ms-ofb/officebrowserfeedback/-/officebrowserfeedback-1.3.0.tgz: Request failed \"401 Unauthorized\"".

Is there any consideration of allowing a custom script to emit better and/or customized error messages? Eg., I could write a script telling my devs that they need to refresh their credentials.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants