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

[BUG]: octokit.graphql gives increasing number of duplicate #549

Open
1 task done
TigersWay opened this issue Feb 4, 2023 · 1 comment
Open
1 task done

[BUG]: octokit.graphql gives increasing number of duplicate #549

TigersWay opened this issue Feb 4, 2023 · 1 comment
Labels
Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented
Projects

Comments

@TigersWay
Copy link

What happened?

I'm trying to call a paginated graphQL query. I always get the same number of results but that result includes more and more duplicates at every run!

  do {
    results = await octokit.graphql(
      `query ($queryStr: String!, $cursor: String) {
        search(query: $queryStr, type: REPOSITORY, first: 100, after: $cursor) {
          nodes {
            ...on Repository {
              nameWithOwner
              name
              description
...
          pageInfo {
            hasNextPage
            endCursor
          }
        }
        rateLimit { limit, cost, remaining, resetAt }
      }`,
      { queryStr: 'topic:eleventy stars:>0', cursor: myCursor }
    );
    repos = repos.concat(results.search.nodes);
    myCursor = results.search.pageInfo.endCursor;
  } while (results.search.pageInfo.hasNextPage);

I originally tried with @octokit/plugin-paginate-graphql which has the same trouble.

I have little/no idea where to start to debug 😊

Versions

@octokit/core: 4.2.0
node: 16.19.0

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@TigersWay TigersWay added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Feb 4, 2023
@ghost ghost added this to Bugs in JS Feb 4, 2023
@TigersWay
Copy link
Author

Adding a sorting term to the query seems to make it work correctly... so far!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented
Projects
Status: 🔥 Backlog
JS
  
Bugs
Development

No branches or pull requests

1 participant