ecosyste-ms / packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.
https://packages.ecosyste.ms
GNU Affero General Public License v3.0
26 stars 5 forks source link

Error 500 on package versions #908

Open yzislin opened 1 month ago

yzislin commented 1 month ago

Hello, First of all, I want to thank you for this great service. It contains enormous amount of useful data and information.

I am experiencing a lot of 500 errors when trying to pull package versions (sometimes on packages as well). This is my api endpoint: https://packages.ecosyste.ms/api/v1/registries/npmjs.org/versions

These are parameters that I pass: params = {"page": 1, "per_page": 1000, "sort": "updated_at", "order": "asc", "updated_after": "2004-10-18T00:00:00.000Z"}

I use python requests to perform these operations. headers = {"Content-Type": "application/x-www-form-urlencoded"} response = requests.get(url, params=params, headers=headers, timeout=20)

Thank you for taking a look.

andrew commented 1 week ago

I saw this error come in today, there's some invalid data showing up:

File: | app/models/version.rb:25:in `download_url'
-- | --
web.1
/api/v1/registries/npmjs.org/versions

MESSAGE

undefined method `registry' for nil

SUMMARY

File:   
app/models/version.rb:25:in `download_url'
Host:   
web.1
Path:   
/api/v1/registries/[npmjs.org/versions](http://npmjs.org/versions)
yzislin commented 1 week ago

I've noticed if I change the timestamp by a minute or so, it will work. To me it feels like there is corruption in data or something. Maybe pagination issue.

andrew commented 1 week ago

I suspect it's that a version is being created and then displayed before it's been fully synced, I'm going to investigate further later today

andrew commented 1 week ago

Deploying an extra filter to avoid rendering invalid versions now.

yzislin commented 1 week ago

Great. Thank you. I will give it a try. I believe I've seen this error on different API calls like advisories as well.

yzislin commented 5 days ago

I am still experiencing 500 errors on the same package versions API call. Thx

andrew commented 5 days ago

I recommend dropping the per_page value down, there’s a max timeout of 30 seconds

yzislin commented 4 days ago

It is not helping. Today for some reason it is really slow and eventually I get 500. curl -v "https://packages.ecosyste.ms/api/v1//registries/npmjs.org/versions?page=1&per_page=4&sort=updated_at&order=asc&updated_after=2022-04-23T22:11:40Z"