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

Libraries.io dependencies badge is flaky #6179

Closed
1 of 3 tasks
mosherc opened this issue Feb 12, 2021 · 7 comments · Fixed by #7080
Closed
1 of 3 tasks

Libraries.io dependencies badge is flaky #6179

mosherc opened this issue Feb 12, 2021 · 7 comments · Fixed by #7080
Labels
needs-upstream-help Not actionable without help from a service provider question Support questions, usage questions, unconfirmed bugs, discussions, ideas service-badge New or updated service badge

Comments

@mosherc
Copy link

mosherc commented Feb 12, 2021

Are you experiencing an issue with...

🪲 Description

Whenever I use the Libraries.io dependency status badge, results are inconsistent, and I get "invalid" as a status for most packages I try. Sometimes they will work until I add a query param (logo or badge style for ex.), then they will say invalid. Also it seems like the info is straight up wrong sometimes?

TypeScript example: Libraries.io dependency status for latest release

🔗 Link to the badge

https://img.shields.io/librariesio/release/npm/@ebth/design-system
https://img.shields.io/librariesio/release/npm/@ebth/design-system?style=for-the-badge

Libraries.io dependency status for latest release, scoped npm package

Libraries.io dependency status for latest release, scoped npm package

For me, those two are showing different results too, the link shows the correct number but the badge above shows invalid. Then when I add the query parameter, it is invalid. Also this keeps changing every time I reload the page or paste it somewhere else...screenshot of what I'm seeing in this issue below shows the inconsistency:
image

libraries.io entry: https://libraries.io/npm/@ebth%2Fdesign-system

As you can see, there are many dependencies that should be out of date. The Sourcerank endpoint also does not work for me.

💡 Possible Solution

I'm guessing that zero dependencies out of date is equivalent to "invalid". Would be nice if this just said zero instead? Many common packages are showing invalid.

side note
I know you can't get Github info for private repos, but it would be nice if that info (stars, number of releases, latest release date, etc.) from npm based endpoints like Libraries.io since those can be public with a private repo.

@mosherc mosherc added the question Support questions, usage questions, unconfirmed bugs, discussions, ideas label Feb 12, 2021
@calebcartwright
Copy link
Member

Thanks for reaching out!

I'm guessing that zero dependencies out of date is equivalent to "invalid". Would be nice if this just said zero instead? Many common packages are showing invalid.

Nope, those are actually very different things. Unfortunately, the Libraries.io API has been notoriously unstable over a fairly long period of time, and at least as of the time of this post, is returning an HTTP 429 response code which is driving the invalid badges

@calebcartwright calebcartwright added the needs-upstream-help Not actionable without help from a service provider label Feb 12, 2021
@calebcartwright
Copy link
Member

The behavior is indicative of rate limiting, but I also get the same result from my local so have added the upstream help label. I don't think we're using any api token for our badge server calls to the Libraries API which we could also investigate to see if it helps

@calebcartwright calebcartwright added the service-badge New or updated service badge label Feb 12, 2021
@chris48s
Copy link
Member

This works locally for me. http://localhost:8080/librariesio/release/npm/@ebth/design-system gives me
design-system

@calebcartwright if you can reproduce the error locally, what does npm run badge https://img.shields.io/librariesio/release/npm/@ebth/design-system spit out? Can you paste-dump?

@calebcartwright
Copy link
Member

The failures are recurrent but not 100% consistent, i'm getting 429 at the moment but the badges in prod seem to be rendering at the moment.

Subset of the output

 Request  🏹 
 https://libraries.io/api/npm/%40ebth%2Fdesign-system/latest/dependencies
{
  "headers": {
    "Accept": "application/json"
  }
}
 Response status code  🎯 
 429
 Handled error  🙅 
 Error: Got status code 429 (expected 200)

    headers: {
      'content-type': 'text/plain',
      'retry-after': '60',
      'cache-control': 'no-cache',
      'x-request-id': 'ebd11249-89d3-4638-9c45-c919b1a63054',
      'x-runtime': '0.001401',
      'x-cloud-trace-context': 'bcb294d24f9c42caad14b7cfbc393e5f/14773168363079047931;o=0',
      'strict-transport-security': 'max-age=31536000; includeSubDomains',
      vary: 'Origin',
      'transfer-encoding': 'chunked',
      date: 'Sat, 13 Feb 2021 16:39:58 GMT',
      via: '1.1 google',
      'alt-svc': 'clear',
      connection: 'close'
    },

@chris48s
Copy link
Member

chris48s commented Feb 13, 2021

Cheers 👍 This is all coming back to me now: 31c253f (this is actually the bower service, but same principle applies)

We are using the API anonymously because it was giving us a higher rate limit than authenticating 😆 If I just chuck a few requests at the libraries.io API it seems like they are now actually enforcing a rate limit on anonymous API requests.

As a first step, lets switch to calling them with an API key to increase our rate limit. I don't know if their documented limit for authenticated requests (60 /minute) is enough to totally fix this for the amount of requests we make. 60/minute gets us 3,600 per hour and according to the dashboard we served 1,680 libraries.io badges in the last hour and a few hundred on bower (which also uses libraries.io) so it'll probably cover us for non-peak times but I wouldn't be surprised if we exceed the limit at peak times.

@chris48s
Copy link
Member

Unfortunately I haven't had time to work on this yet, but if anyone is interested in picking it up, here's some notes that scope out the job:

@calebcartwright
Copy link
Member

Another thing we could do if someone else is willing to donate a key, we could set 2 keys: 1 for bower badges and 1 for libraries.io badges (even though they are the same API) to try and stay under the rate limit.

I don't have an account but assume we could set one up (maybe using one of the shared shields.io emails?) and/or i could create one and donate one as well

@paulmelnikow paulmelnikow changed the title Libraries.io Dependencies Not Working Libraries.io dependencies badge is flaky Jul 9, 2021
szmarczak added a commit to sindresorhus/got that referenced this issue Aug 23, 2021
renawolford6 pushed a commit to renawolford6/React-Benchmark-got-repos that referenced this issue Oct 6, 2022
`shields.io` is unstable :(
See badges/shields#6179
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-upstream-help Not actionable without help from a service provider question Support questions, usage questions, unconfirmed bugs, discussions, ideas service-badge New or updated service badge
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants