Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 3

[bug] GraphQL API fails with 400 in strange way

I tried out magit forge, and noticed it consistently failed on a certain query. It generates GraphQL queries to batch fetch repository/issue information. Most of them work, but a specific one would fail. I tried it out in the graphql explorer and minimized it until it would start working, then added back the fragment that cause it to fail. Try out the below and see it fail, but remove any of the top level fragments and the query works.

 

An example error message from magit forge is Something went wrong while executing your query. Please include `F3BD:3184:40DA53:565425:5D84AB02` when reporting this issue.

 

query {
  _Z2l0aHViLmNvbTowMTA6UmVwb3NpdG9yeTQxMjg4NzA4OjQ1MzczNDQxMg__: repository (
    name: "sourcegraph",
    owner: "sourcegraph") {
    issue (
      number: 2360) {
      number
      state
      author {
        login
      }
      title
      createdAt
      updatedAt
      closedAt
      locked
      milestone {
        id
      }
      body
      assignees (
        first: 100) {
        pageInfo {
          endCursor
          hasNextPage
        }
        edges {
          node {
            id
          }
        }
      }
      comments (
        first: 100) {
        pageInfo {
          endCursor
          hasNextPage
        }
        edges {
          node {
            databaseId
            author {
              login
            }
            createdAt
            updatedAt
            body
          }
        }
      }
      labels (
        first: 100) {
        pageInfo {
          endCursor
          hasNextPage
        }
        edges {
          node {
            id
          }
        }
      }
    }
  }
  _Z2l0aHViLmNvbTowMTA6UmVwb3NpdG9yeTQxMjg4NzA4OjU1MDE1NTkxMw__: repository (
    name: "sourcegraph",
    owner: "sourcegraph") {
    pullRequest (
      number: 4959) {
      number
      state
      author {
        login
      }
      title
      createdAt
      updatedAt
      closedAt
      mergedAt
      locked
      maintainerCanModify
      isCrossRepository
      milestone {
        id
      }
      body
      baseRef {
        name
        repository {
          nameWithOwner
        }
      }
      headRef {
        name
        repository {
          owner {
            login
          }
          nameWithOwner
        }
      }
      assignees (
        first: 100) {
        pageInfo {
          endCursor
          hasNextPage
        }
        edges {
          node {
            id
          }
        }
      }
      reviewRequests (
        first: 100) {
        pageInfo {
          endCursor
          hasNextPage
        }
        edges {
          node {
            requestedReviewer {
              ... on User { id }

            }
          }
        }
      }
      comments (
        first: 100) {
        pageInfo {
          endCursor
          hasNextPage
        }
        edges {
          node {
            databaseId
            author {
              login
            }
            createdAt
            updatedAt
            body
          }
        }
      }
      labels (
        first: 100) {
        pageInfo {
          endCursor
          hasNextPage
        }
        edges {
          node {
            id
          }
        }
      }
    }
  }
  _Z2l0aHViLmNvbTowMTA6UmVwb3NpdG9yeTQxMjg4NzA4OjU1MDg2NzU5MA__: repository (
    name: "sourcegraph",
    owner: "sourcegraph") {
    pullRequest (
      number: 4965) {
      number
      state
      author {
        login
      }
      title
      createdAt
      updatedAt
      closedAt
      mergedAt
      locked
      maintainerCanModify
      isCrossRepository
      milestone {
        id
      }
      body
      baseRef {
        name
        repository {
          nameWithOwner
        }
      }
      headRef {
        name
        repository {
          owner {
            login
          }
          nameWithOwner
        }
      }
      assignees (
        first: 100) {
        pageInfo {
          endCursor
          hasNextPage
        }
        edges {
          node {
            id
          }
        }
      }
      reviewRequests (
        first: 100) {
        pageInfo {
          endCursor
          hasNextPage
        }
        edges {
          node {
            requestedReviewer {
              ... on User { id }

            }
          }
        }
      }
      comments (
        first: 100) {
        pageInfo {
          endCursor
          hasNextPage
        }
        edges {
          node {
            databaseId
            author {
              login
            }
            createdAt
            updatedAt
            body
          }
        }
      }
      labels (
        first: 100) {
        pageInfo {
          endCursor
          hasNextPage
        }
        edges {
          node {
            id
          }
        }
      }
    }
  }
}
2 Replies
Community Manager
Message 2 of 3

Re: [bug] GraphQL API fails with 400 in strange way

I ran the query you gave below and it worked for me. Can you verify that you're still receiving an error on this?

 

Let us know.

Copilot Lvl 2
Message 3 of 3

Re: [bug] GraphQL API fails with 400 in strange way

It is still failing for me. Note when I do this in the graphql explorer I get a response of `""` shown in the explorer, and the network tab in developer tools says the request 400ed. When I do this directly against the graphql API I get the error described above.