pastelsky / bundlephobia

🏋️ Find out the cost of adding a new frontend dependency to your project
https://bundlephobia.com
MIT License
8.89k stars 221 forks source link

Algolia similar packages API response error causes chart to hide after page load #793

Open KrofDrakula opened 1 year ago

KrofDrakula commented 1 year ago

Describe the bug

When browsing particular packages (say, @krofdrakula/drop), the page briefly shows the package size chart, but there is an error response from Algolia which then hides the chart.

To Reproduce

Open https://bundlephobia.com/package/@krofdrakula/drop and notice the chart hiding after the page loads:

https://github.com/pastelsky/bundlephobia/assets/112161/2b11129d-ec4d-4196-9645-4125f7ae5d52

The console shows the following error being reported:

Error response from Algolia in dev tools console ```json { "error": { "name": "HTTPError", "host": "ofcncog2cu-dsn.algolia.net", "hostname": "ofcncog2cu-dsn.algolia.net", "method": "GET", "path": "/1/indexes/npm-search/%40krofdrakula%2Fdrop?x-algolia-application-id=OFCNCOG2CU&x-algolia-api-key=f54e21fa3a2a0160595bb058179bfb1e", "protocol": "https:", "url": "https://ofcncog2cu-dsn.algolia.net/1/indexes/npm-search/%40krofdrakula%2Fdrop?x-algolia-application-id=OFCNCOG2CU&x-algolia-api-key=f54e21fa3a2a0160595bb058179bfb1e", "gotOptions": { "path": "/1/indexes/npm-search/%40krofdrakula%2Fdrop?x-algolia-application-id=OFCNCOG2CU&x-algolia-api-key=f54e21fa3a2a0160595bb058179bfb1e", "protocol": "https:", "slashes": true, "auth": null, "host": "ofcncog2cu-dsn.algolia.net", "port": null, "hostname": "ofcncog2cu-dsn.algolia.net", "hash": null, "search": "?x-algolia-application-id=OFCNCOG2CU&x-algolia-api-key=f54e21fa3a2a0160595bb058179bfb1e", "pathname": "/1/indexes/npm-search/%40krofdrakula%2Fdrop", "href": "https://ofcncog2cu-dsn.algolia.net/1/indexes/npm-search/%40krofdrakula%2Fdrop?x-algolia-application-id=OFCNCOG2CU&x-algolia-api-key=f54e21fa3a2a0160595bb058179bfb1e", "retry": { "methods": {}, "statusCodes": {}, "errorCodes": {} }, "headers": { "user-agent": "got/9.6.0 (https://github.com/sindresorhus/got)", "accept": "application/json", "accept-encoding": "gzip, deflate" }, "hooks": { "beforeRequest": [], "beforeRedirect": [], "beforeRetry": [], "afterResponse": [], "beforeError": [], "init": [] }, "decompress": true, "throwHttpErrors": true, "followRedirect": true, "stream": false, "form": false, "json": true, "cache": false, "useElectronNet": false, "method": "GET" }, "statusCode": 404, "statusMessage": "Not Found", "headers": { "server": "nginx", "date": "Tue, 23 May 2023 10:52:52 GMT", "content-type": "application/json; charset=UTF-8", "content-length": "51", "connection": "close", "accept-encoding": "deflate, gzip", "cache-control": "no-store", "access-control-allow-origin": "*", "timing-allow-origin": "*", "x-content-type-options": "nosniff", "strict-transport-security": "max-age=31536000; includeSubDomains; preload", "content-disposition": "inline; filename=a.txt" }, "body": { "message": "ObjectID does not exist", "status": 404 } } } ```

Expected behavior

The chart should be visible like on other packages, like https://bundlephobia.com/package/preact@10.15.0.