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

Error Fetching GitHub contribution data for "..." failed: User "..." not found. #82

Closed
adriangalilea opened this issue Mar 28, 2024 · 20 comments

Comments

@adriangalilea
Copy link

adriangalilea commented Mar 28, 2024

Hello,

I've implemented your component in a site I'm developing,

e-id.to/adriangalilea

After a while I get

Error Fetching GitHub contribution data for "..." failed: User "..." not found.

I'm guessing this is due being rate limited, If this is the case a clear error message for rate limiting would be nice.

As you can see it happens to me even on your site:
image

I've also noticed this:

A simple API that returns number of GitHub contributions based on a users GitHub profile. This API is used by [React GitHub Calendar](https://github.com/grubersjoe/react-github-calendar) (React component).

⚠️ Results are cached for one hour!

So it's not clear to me why this could be the case, maybe it's how I'm using it on dev that's not caching it appropriately.

This is the file and my next.js project.

How can I debug the caching?

I would also like to customise for how long or where I store the data preferably, is this reasonable?

Or perhaps your other 2 libraries in conjunction would lead me to have more manual control over this?

Thank you for this great component,

Adrian.

@grubersjoe
Copy link
Owner

grubersjoe commented Mar 28, 2024

Hey. Thanks for reporting this! However, caching is not the issue, but GitHub seems to have changed how the contribution graph is rendered. Now client-side JavaScript appears to be required to generate the calendar markup on the GH profile page. You can test this by disabling JavaScript in your browser (the chart never shows up, but you will only see a spinner forever). Consequently, the contribution data can no longer be scraped by simply parsing the HTML source.

So this will make things harder, unfortunately, and I have to think about this. There probably is no way around something like Puppeteer which sounds quite heavy.

@adriangalilea
Copy link
Author

Hey. Thanks for reporting this! However, caching is not the issue, but GitHub seems to have changed how the contribution graph is rendered. Now client-side JavaScript appears to be required. You can test this by disabling JavaScript in your browser (the chart never shows up, but you will only see a spinner forever). Consequently, the contribution data can no longer be scraped by simply parsing the HTML source.

So this will make this a lot harder, unfortunately, and I have to think about this. There probably is no way around something like Puppeteer which sounds quite heavy.

Oh wow, I thought this was using API or something.

Regarding client-side, I do force the component to run client side "use client"; but still fails, was working great yesterday.

@grubersjoe
Copy link
Owner

grubersjoe commented Mar 29, 2024

This component does use an API that handles the scraping:
https://github.com/grubersjoe/github-contributions-api

The described issue is in the context of this API.

@adriangalilea
Copy link
Author

adriangalilea commented Mar 29, 2024

This component does use an API that handles the scraping: https://github.com/grubersjoe/github-contributions-api

The described issue is in the context of this API.

What about using something like this it's freemium, but perhaps alongside a good caching strategy can go a long way, and it seems fairly easy compared to puppeteer or other alternatives.

Probably not within the scope of what you were aiming, more a patch/hack(fallback even) if there's no available clean solution, what do you think?

@grubersjoe
Copy link
Owner

Puppeteer is not hard to use and Microlink seems to use it under the hood as well. So I guess I'll have to move github-contributions-api from Cheerio to Puppeteer. This will take a bit of time, though. Sorry people.

@shinobi8894
Copy link

So, we can't get contrbution of github anymore ?

@grubersjoe
Copy link
Owner

grubersjoe commented Mar 29, 2024

No, not until the API is fixed, which I'll do as soon a possible.

The issue with scraping simply is that it can break any time when GitHub changes how they render the calendar.

@PrarthnaLuthra
Copy link

Hi roughly how much time will it take for this issue to be fixed?

@PrarthnaLuthra
Copy link

It would be really helpful if it gets fixed early

@grubersjoe
Copy link
Owner

grubersjoe commented Mar 29, 2024

I'll be working on it this weekend. A few days at most.

Please see this issue for further progress:
grubersjoe/github-contributions-api#7

@PrarthnaLuthra
Copy link

Sure thanks!

@tommypurcell
Copy link

Thanks for posting this issue!

Is the problem that the github API does not serve the contribution data so it needs to be scraped?

I understand from your messages that Github changed their calendar rendering which broke react-github-calendar.

@PrarthnaLuthra
Copy link

I tried to fetch this endpoint https://api.github.com/users/${username}/contributions but I am getting this error {
"message": "Not Found",
"documentation_url": "https://docs.github.com/rest"
}

@tommypurcell
Copy link

Yea I'm not seeing that as an endpoint.

@adriangalilea
Copy link
Author

@ everyone

Don't pressure grubersjoe we should just be thankful and patient or try to fix it ourselves since it's opensource.

Keep the conversation clean and read the messages above before commenting, remember that everyone subscribed to this thread will get emails and notifications.

@jiwooproity
Copy link

Thanks for posting this issue.
I'm using your api really well. I'll be rooting for you.

@paulaneesh7
Copy link

I'll be working on it this weekend. A few days at most.

Please see this issue for further progress: grubersjoe/github-contributions-api#7

I had this contribution graph embedded in my site and suddenly I saw error in fetching the data, thanks for this info that it will fixed

@sampconrad
Copy link

Appreciate you being on top of this so quickly @grubersjoe . Godspeed to ya!

You're the man!

@grubersjoe
Copy link
Owner

@d3or found a nice and easy solution: grubersjoe/github-contributions-api#8

Just deployed the latest version of the API, everything should work again!

@PrarthnaLuthra
Copy link

@d3or found a nice and easy solution: grubersjoe/github-contributions-api#8

Just deployed the latest version of the API, everything should work again!

Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants