404's from registry trigger 500 from npm_lazy
Closed this issue · 10 comments
It looks like any kind of error code causes a 500 error to be returned. Since 404 is "ok" for non-existant packages, the 500 makes it look like the registry (or npm_lazy) is broken.
I see the docs say:
Starting with v1.2.0, npm_lazy will only return a 500 error if it does not have specific file.
But this makes it hard to tell the difference between npm_lazy itself failing or an expected 404 from the registry.
Just tried to install a non-existing package through npm_lazy.
My npm install tevfdvd
just hung.
Here's the log of node_lazy: http://screencast.com/t/4bNHiXACko9
... in a while it unhung with 500.
Indeed, should be fixed before this is considered prod. ready.
We need this fixed, too. Temporary outtages of registry.npmjs.org breaks our continuous build environment.
@kleini What sort of outages were you getting, were they 404 responses from npm or other?
What would the desired behavior if an error was returned from npm and would it be different for different codes (e.g. 404, 500, ...)
I have a potential fix ^ above.
Can the reporters perhaps give it a test and then I will see if we can get it merged in. (Will have to make some tests in that case.)
@mixu - what do you think about my commit above - do you think it's on the right track?
It should give immediate 404's for bad package names, but retry as per normal for other errors. The final try will return the status code and response from upstream.
@CL0SeY yeah, looks good to me. Also, in light of all the awesome work you've been doing on npm_lazy I added you to the repo (also sent an email about that to you directly).
@CL0SeY I am sorry, for my late response. I have the case, that npm tries to find some packages on registry.npmjs.org, which do not exist. registry.npmjs.org returns in those cases 404, which makes npm know, that some package in some version does not exist and continues. If I use npm_lazy, these 404 responses from registry.npmjs.org are reported as 500 status codes to npm, which makes npm fail immediately and not trying something else.
If you need more details on this, please ask, I will try to provide the information then.
@kleini Thanks for for the information, I suspect the problem is fixed with my latest patch that I am about to merge in - #43
(If you wanted to see it in action you could clone down my fork https://github.com/CL0SeY/npm_lazy)