fix: prevent server crash when GitHub API returns null data#4784
fix: prevent server crash when GitHub API returns null data#4784daniwebdevid wants to merge 1 commit intoanuraghazra:masterfrom
Conversation
|
@daniwebdevid is attempting to deploy a commit to the github readme stats Team on Vercel. A member of the Team first needs to authorize it. |
|
Hi @daniwebdevid, thanks for the contribution! retryer.js already has various ways to detect invalid responses. Can you provide a reproducible example how to get invalid data from the GitHub API which is not yet detected by retryer.js? It would probably be best to handle additional error cases in retryer.js too. And we should also have a test for this new error handling. |
|
Hi, thanks @martin-mfg for the response! In my case, the API didn't return a standard error message. Instead, it seems to return a null value for certain user data, which then triggers the Cannot read properties of null (reading 'slice') error in the frontend/SVG output.
I've attached a screenshot of the SVG output I received. It shows the error message rendered directly inside the SVG box. I will try to investigate retryer.js to see why this specific null response isn't being caught by the current logic. |
|
I noticed you're using the service at Alternatively you can use github-readme-stats-action or github-stats-extended. Btw, out of curiosity: Where did you get to know about HwangTaehyun/github-repository-contribution-stats? |
|
Hi @qwerty541, thanks for asking! I actually found this repo while investigating an issue with my README profile, which I generated using GPRM. I noticed the stats weren't rendering correctly and tracked the error back to the API response handling. I realized the null (reading 'slice') crash was happening because of how the fetchers in this repository process data when the GitHub API is under rate limit or returns empty results. Even though I saw the other service, I believe fixing the logic here is important for the stability of this project. I've tested it locally and it fixes the crash, so I hope it can be merged to help others facing the same issue. Cheers! |

Description
Fixed a runtime error where the server would crash with
Cannot read properties of null (reading 'slice'). This happens when the GitHub API returns null data (common during rate limits or internal API errors).Changes
repoNodesin fetchers.Verification