-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Labels
Status: Up for grabsIssues that are ready to be worked on by anyoneIssues that are ready to be worked on by anyoneType: FeatureNew feature or requestNew feature or request
Description
Describe the need
If you run:
import { Octokit } from "@octokit/core";
import { paginateGraphQL } from "@octokit/plugin-paginate-graphql";
import process from "node:process";
const octokit = new (Octokit.plugin(paginateGraphQL))({
auth: process.env.GITHUB_TOKEN,
});
console.log(
await octokit.graphql.paginate(`query ($cursor: String) {
nodes(ids: ["MDU6SXNzdWUxMDA1NzMzMzY2"]) {
... on Issue {
timelineItems(first: 100, after: $cursor, itemTypes: [ISSUE_COMMENT]) {
pageInfo {
endCursor
hasNextPage
}
nodes {
__typename
}
}
}
}
}
`)
);you'll get the error:
file:///.../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@octokit/plugin-paginate-graphql/dist-bundle/index.js:41
throw new MissingPageInfo(responseData);
^
MissingPageInfo: No pageInfo property found in response. Please make sure to specify the pageInfo in your query. Response-Data: {
"nodes": [
{
"timelineItems": {
"pageInfo": {
"endCursor": "Y3Vyc29yOnYyOpPPAAABj8psBWAAqjIxNDAyNTEyNjY=",
"hasNextPage": false
},
"nodes": [
{
...
This is confusing because there clearly is a pageInfo property sitting there, and there's only one item to page through. The fix is to use the node query instead of the nodes query to get rid of the 1-element array, and the error message could say that.
Or the code could notice that there's exactly one pageInfo object and optimistically page through that even though it's surrounded by an array.
SDK Version
@octokit/plugin-paginate-graphql 5.2.2
API Version
No response
Relevant log output
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
Status: Up for grabsIssues that are ready to be worked on by anyoneIssues that are ready to be worked on by anyoneType: FeatureNew feature or requestNew feature or request
Type
Projects
Status
🔥 Backlog