-
Notifications
You must be signed in to change notification settings - Fork 331
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
[BUG] GiHub GraphQL api got http 502 error #67
Comments
That's odd. 502 is the bad gateway of HTTP code but we are using GraphQL here. |
Hey, I actually got the same error. You can find it here: https://github.com/d12frosted/d12frosted/actions/runs/1384168586 Let me know if you need any extra information to debug this. BTW, graphql is over http, so http status codes apply here as well. |
Can reproduce locally. Added some logs:
|
What works - splitting this huge query into several. I tried the following: const fetcher1 = (token, variables) => {
// contain private need token permission
// contributionsCollection default to a year ago
return request(
{
Authorization: `bearer ${token}`,
},
{
query: `
query UserDetails($login: String!) {
user(login: $login) {
id
name
email
createdAt
twitterUsername
company
location
websiteUrl
repositories(first: 100,privacy:PUBLIC, isFork: false, ownerAffiliations: OWNER, orderBy: {direction: DESC, field: STARGAZERS}) {
totalCount
nodes {
stargazers {
totalCount
}
}
}
}
}
`,
variables,
}
);
};
const fetcher2 = (token, variables) => {
// contain private need token permission
// contributionsCollection default to a year ago
return request(
{
Authorization: `bearer ${token}`,
},
{
query: `
query UserDetails($login: String!) {
user(login: $login) {
contributionsCollection {
contributionCalendar {
weeks {
contributionDays {
contributionCount
date
}
}
}
contributionYears
}
}
}
`,
variables,
}
);
};
const fetcher3 = (token, variables) => {
// contain private need token permission
// contributionsCollection default to a year ago
return request(
{
Authorization: `bearer ${token}`,
},
{
query: `
query UserDetails($login: String!) {
user(login: $login) {
repositoriesContributedTo(first: 1,includeUserRepositories:true, privacy:PUBLIC, contributionTypes: [COMMIT, ISSUE, PULL_REQUEST, REPOSITORY]) {
totalCount
}
pullRequests(first: 1) {
totalCount
}
issues(first: 1) {
totalCount
}
}
}
`,
variables,
}
);
}; And then combining everything: const user = { ...res1.data.data.user, ...res2.data.data.user, ...res3.data.data.user }; And that worked for If you wish, I can send a PR fixing both of them. |
Yeah, I know, I mean we do not do any change here so it is odd to that we suddenly get 502 error. 🤔 |
@d12frosted Thanks!! If you resend the request would it still respond with a 502 error? Cuz I found something similar here magit/ghub#83 If we ensure the problem is about request limitations then we will need this PR. |
Even by splitting request into multiple I still run into 502 time to time. So I added some retries and now it's more stable. In addition, I usually experienced 502 more often during StatsCard generation. So it got me thinking, maybe profile should not be fetched twice? |
Maybe we can add some retries and don't need to split the request? For locally and GitHub Action usage we don't need to fetch twice, but to deploy on Vercel we need it because every request is independent of others. |
Maybe it is a GitHub upstream service issue.🤔 |
This is what I say :) I added retries and everything become better :) If you wish, I can send a PR with retries only. |
Yes, please. 😄 |
glad to hear that your guys have found the solutation🎉 |
It is released now, thanks for your hard work. 🎉 |
In my case, sometimes it is because the result of the query is too large (I reduce the number of issues to be returned from 100 to 10, and it works). |
Describe the bug
several cards' svg can not generated successfully.
Expected behavior
All cards should be generated successfully.
Errors
The text was updated successfully, but these errors were encountered: