Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

503 on HTTP GET for tarballs using CORS from a browser client #228

Closed
maxleiko opened this issue Mar 23, 2015 · 14 comments
Closed

503 on HTTP GET for tarballs using CORS from a browser client #228

maxleiko opened this issue Mar 23, 2015 · 14 comments

Comments

@maxleiko
Copy link

http://status.npmjs.org/ states that there were some 503 for tarballs Mar 21, 2015 during 2 hours.
Looks like today there is a lot more, isn't it ?

I'm trying to retrieve tarballs directly within the browser using Ajax (because it looks like tarballs have CORS on their GET response (yay)), but I can't manage to get them all, it's really erratic, I get a lot of random 503 responses.

Can someone confirm the 503 ?

@bcoe
Copy link
Contributor

bcoe commented Mar 23, 2015

@maxleiko we're not seeing any increased levels or 503s currently, could you share one of the URLs that you are attempting to download?

@maxleiko
Copy link
Author

Mainly

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

I've never been able to reproduce the 503 using curl, I only had 503 statuses by using some JavaScript and XMLHttpRequest.

@bcoe
Copy link
Contributor

bcoe commented Mar 23, 2015

@maxleiko I can't reproduce with curl, or with installs through the npm registry.

I think this is related to how an XMLHttpRequest is being handled through our CDN, and is unrelated to the spike in 503s we saw last week.

Having said this, perhaps you can change the title of this ticket to reflect that the bug you're seeing is related to CORS/XMLHttpRequest, and we can try to get this fixed for you in the future.

@maxleiko maxleiko changed the title Lot of 503 for tarballs 503 on HTTP GET for tarballs using CORS from a browser client Mar 23, 2015
@maxleiko
Copy link
Author

I suspected something like this too. I saw a lot of weird behaviors induced by the cache system of the CDN. Can't figure out where the problem is though.

@maxleiko
Copy link
Author

Current response on http://braindead.fr:8085/registry.npmjs.org/kevoree-node-javascript/-/kevoree-node-javascript-5.0.4.tgz

Remote Address:185.31.17.162:80
Request URL:http://registry.npmjs.org/kevoree-node-javascript/-/kevoree-node-javascript-5.0.4.tgz
Request Method:GET
Status Code:503 backend read error

====== REQUEST HEADERS ======
Accept:*/*
Accept-Encoding:gzip, deflate, sdch
Accept-Language:fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4,da;q=0.2,de;q=0.2,pl;q=0.2,it;q=0.2,es;q=0.2
Connection:keep-alive
Content-Type:text/plain
Host:registry.npmjs.org
Origin:http://localhost:9000
Referer:http://localhost:9000/
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36

====== RESPONSE HEADERS ======
Accept-Ranges:bytes
Connection:keep-alive
Content-Length:447
Content-Type:text/html; charset=utf-8
Date:Tue, 24 Mar 2015 10:54:31 GMT
Retry-After:0
Server:Varnish
Via:1.1 varnish
X-Cache:MISS
X-Cache-Hits:0
X-Served-By:cache-fra1245-FRA
X-Timer:S1427194450.804019,VS0,VE20337

No response body.

Earlier this morning I had this response body when using a proxy:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>503 backend read error</title>
  </head>
  <body>
    <h1>Error 503 backend read error</h1>
    <p>backend read error</p>
    <h3>Guru Mediation:</h3>
    <p>Details: cache-lhr6325-LHR 1427194341 1927343612</p>
    <hr>
    <p>Varnish cache server</p>
  </body>
</html>

@maxleiko
Copy link
Author

@bcoe Google Chrome provides a useful "Copy as cURL" 👍 that allows me to reproduce the error:

curl 'http://registry.npmjs.org/kevoree-group-remotews/-/kevoree-group-remotews-5.2.6-SNAPSHOT.tgz' \
  -H 'Origin: http://runjs.kevoree.org'\
  -H 'Accept-Encoding: gzip, deflate, sdch'\
  -H 'Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4,da;q=0.2,de;q=0.2,pl;q=0.2,it;q=0.2,es;q=0.2'\
  -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36'\
  -H 'Accept: */*'\
  -H 'Referer: http://runjs.kevoree.org/'\
  -H 'Connection: keep-alive'\
  --compressed

@maxleiko
Copy link
Author

I'm a bit lost.

The registry is giving http://registry.npmjs.org/kevoree-group-remotews/-/kevoree-group-remotews-5.2.6-SNAPSHOT.tgz as the tarball URL location here http://registry.npmjs.org/kevoree-group-remotews/5.2.6-SNAPSHOT, but there is no way for me to download it directly.

Npm is also giving the same link

npm view kevoree-group-remotews dist.tarball

npm install, cURL and wget do not work.

npm -d install kevoree-group-remotews
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info attempt registry request try #1 at 11:58:10
npm http request GET https://registry.npmjs.org/kevoree-group-remotews
npm http 200 https://registry.npmjs.org/kevoree-group-remotews
npm info retry fetch attempt 1 at 11:58:11
npm info attempt registry request try #1 at 11:58:11
npm http fetch GET https://registry.npmjs.org/kevoree-group-remotews/-/kevoree-group-remotews-5.2.6-SNAPSHOT.tgz
npm http fetch 404 https://registry.npmjs.org/kevoree-group-remotews/-/kevoree-group-remotews-5.2.6-SNAPSHOT.tgz
npm ERR! fetch failed https://registry.npmjs.org/kevoree-group-remotews/-/kevoree-group-remotews-5.2.6-SNAPSHOT.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 404
npm info retry fetch attempt 2 at 11:58:22
npm info attempt registry request try #1 at 11:58:22
npm http fetch GET https://registry.npmjs.org/kevoree-group-remotews/-/kevoree-group-remotews-5.2.6-SNAPSHOT.tgz
npm http fetch 404 https://registry.npmjs.org/kevoree-group-remotews/-/kevoree-group-remotews-5.2.6-SNAPSHOT.tgz
npm ERR! fetch failed https://registry.npmjs.org/kevoree-group-remotews/-/kevoree-group-remotews-5.2.6-SNAPSHOT.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 404

@maxleiko
Copy link
Author

New release of my module kevoree-group-remotews fixed the issue. This is still weird.

@bcoe
Copy link
Contributor

bcoe commented Mar 27, 2015

@maxleiko where are you finding the URL: http://registry.npmjs.org/kevoree-group-remotews/5.2.6-SNAPSHOT

If I look at the history of publications for kevoree-group-remoteews, all the tarballs seem correct:

http://registry.npmjs.org/kevoree-group-remotews

Note all the .tgz files in this JSON.

@maxleiko
Copy link
Author

@bcoe Where am I finding the URL ? Huh, not sure to understand that question. I know that if you want to retrieve any module information you just have to GET on registry.npmjs.org/{name}/{version}

So I did, and the dist['tarball'] value is pointing to the .tgz URL

If I look at the history of publications for kevoree-group-remoteews, all the tarballs seem correct

Nope, not all the tarball.
Just try to get the 5.2.6-SNAPSHOT one, you will get a 404. But the previous one (3.0.1) and the latest (5.2.7) are ok.
That's a part of the issue.

@maxleiko
Copy link
Author

@bcoe you can see the 404 by doing

npm uses the same link as me (of course), so it gets a 404 too.

@maxleiko
Copy link
Author

But the tarball exists according to npm registry

╭─leiko@kevtop ~  
╰─➤  npm view [email protected] dist.tarball
http://registry.npmjs.org/kevoree-group-remotews/-/kevoree-group-remotews-5.2.6-SNAPSHOT.tgz

@bcoe
Copy link
Contributor

bcoe commented Mar 27, 2015

@maxleiko I think I see the underlying issue and am digging into it.

@bcoe
Copy link
Contributor

bcoe commented Mar 27, 2015

@maxleiko thanks for bringing this to our attention.

I've fixed the [email protected], and the underlying problem.

@bcoe bcoe closed this as completed Jan 22, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants