Check registry status code for 500 errors #6400
Closed
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Summary
Over the last week I received several reports from Heroku users using Yarn to install dependency where the installation would fail. Generally the errors would be one of these two:
The next build would generally succeed, but then a different module would fail an integrity check. I deployed a modified version of Yarn that would console log the response when one of these errors would occur and found that in these cases, CloudFlare was returning a 500 response with an HTML error message as the
body. This is not common, but I was able to recreate it by curling a particular tarball in the registry in a loop.Looking at the malformed response code, it would receive the HTML error page, check for parameters, and then fail with the error above.
This PR adds an explicit check for the case that the returned status code is 500 or greater without relying on a JSON response with an
errorfield.Test plan