Skip to content

[email protected] returning GraphQL errors when running gh pr checks command #7716

Description

@danxg87

Describe the bug

This has been encountered only with the latest gh release 2.32.0:
When we run gh pr checks or gh pr checks $PR_NUMBER or gh pr checks $BRANCH_NAME we always receive the following message:

GraphQL: Field 'event' doesn't exist on type 'WorkflowRun' (query PullRequestStatusChecks.node.... on PullRequest.statusCheckRollup.nodes.commit.statusCheckRollup.contexts.nodes.... on CheckRun.checkSuite.workflowRun.event)

Note: This has been replicated both locally on Linux+MacOS and on github action runners (where we first debugged this failure) for us.

Steps to reproduce the behavior

  1. Type gh pr checks $PR_NUMBER where $PR_NUMBER is the number of the pull request in question
  2. View the output
  3. See the above error

Expected vs actual behavior

Expect: the usual pr checks to show with any failed/passed/pending PR checks
Actually: receive the above gql failure message

Logs

dgeorge @ stationx ~/my_repo (kd/testing-issues)
└─ $ ➤ gh pr checks 844
GraphQL: Field 'event' doesn't exist on type 'WorkflowRun' (query PullRequestStatusChecks.node.... on PullRequest.statusCheckRollup.nodes.commit.statusCheckRollup.contexts.nodes.... on CheckRun.checkSuite.workflowRun.event)
dgeorge @ stationx ~/my_repo (kd/testing-issues)
└─ $ ➤

NOTE: When manually downloading/running 2.31.0 everything works just fine.

Activity

  1. samcoe commented on Jul 17, 2023

    @samcoe
    Contributor

    @danxg87 Thanks for reporting. This looks to be a regression in the latest version due to #7618. Could you run the command again with GH_DEBUG=api environment variable enabled and paste the logs here so we can better debug what is happening? Please make sure to edit out any private details from the logs before pasting them.

  2. danxg87 commented on Jul 17, 2023

    @danxg87
    Author

    @samcoe for sure, here's the goods:

    ➤ GH_DEBUG=api gh pr checks 844
    [git remote -v]
    [git config --get-regexp ^remote\..*\.gh-resolved$]
    ⣾* Request at 2023-07-17 16:07:54.143804 -0400 EDT m=+0.055318585
    * Request to https://github...com/api/graphql
    > POST /api/graphql HTTP/1.1
    > Host: github...com
    > Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
    > Authorization: token ...
    > Content-Length: 308
    > Content-Type: application/json; charset=utf-8
    > Graphql-Features: merge_queue
    > Time-Zone: America/New_York
    > User-Agent: GitHub CLI 2.32.0
    
    GraphQL query:
    query PullRequestByNumber($owner: String!, $repo: String!, $pr_number: Int!) {
        repository(owner: $owner, name: $repo) {
          pullRequest(number: $pr_number) {number,headRefName,id}
        }
      }
    GraphQL variables: {"owner":"company","pr_number":844,"repo":"my_repo"}
    
    ⣽< HTTP/2.0 200 OK
    < Access-Control-Allow-Origin: *
    < Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
    < Content-Security-Policy: default-src 'none'
    < Content-Type: application/json; charset=utf-8
    < Date: Mon, 17 Jul 2023 20:07:54 GMT
    < Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
    < Server: GitHub.com
    < Strict-Transport-Security: max-age=31536000; includeSubdomains
    < X-Accepted-Oauth-Scopes: repo
    < X-Content-Type-Options: nosniff
    < X-Frame-Options: deny
    < X-Github-Enterprise-Version: 3.8.4
    < X-Github-Media-Type: github.merge-info-preview; param=nebula-preview; format=json
    < X-Github-Request-Id: ...
    < X-Oauth-Client-Id: ...
    < X-Oauth-Scopes: gist, read:org, repo, workflow
    < X-Ratelimit-Limit: 5000
    < X-Ratelimit-Remaining: 5000
    < X-Ratelimit-Reset: 1689628074
    < X-Ratelimit-Resource: graphql
    < X-Ratelimit-Used: 0
    < X-Runtime-Rack: 0.078155
    < X-Xss-Protection: 0
    
    {
      "data": {
        "repository": {
          "pullRequest": {
            "number": 844,
            "headRefName": "kd/testing-issues",
            "id": "ABC123"
          }
        }
      }
    }
    
    * Request took 199.599708ms
    * Request at 2023-07-17 16:07:54.344223 -0400 EDT m=+0.255735335
    * Request to https://github...com/api/graphql
    > POST /api/graphql HTTP/1.1
    > Host: github...com
    > Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
    > Authorization: token ...
    > Content-Length: 618
    > Content-Type: application/json; charset=utf-8
    > Graphql-Features: merge_queue
    > Time-Zone: America/New_York
    > User-Agent: GitHub CLI 2.32.0
    
    GraphQL query:
    query PullRequestStatusChecks($id: ID!, $endCursor: String) {
        node(id: $id) {
          ...on PullRequest {
            statusCheckRollup: commits(last: 1) {nodes {commit {statusCheckRollup {contexts(first:100,after:$endCursor) {nodes {__typename...on StatusContext {context,state,targetUrl,createdAt,description,isRequired(pullRequestId: $id)},...on CheckRun {name,checkSuite{workflowRun{event,workflow{name}}},status,conclusion,startedAt,completedAt,detailsUrl,isRequired(pullRequestId: $id)}},pageInfo{hasNextPage,endCursor}}}}}}
          }
        }
      }
    GraphQL variables: {"id":"ABC123"}
    
    < HTTP/2.0 200 OK
    < Access-Control-Allow-Origin: *
    < Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
    < Content-Security-Policy: default-src 'none'
    < Content-Type: application/json; charset=utf-8
    < Date: Mon, 17 Jul 2023 20:07:54 GMT
    < Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
    < Server: GitHub.com
    < Strict-Transport-Security: max-age=31536000; includeSubdomains
    < X-Accepted-Oauth-Scopes: repo
    < X-Content-Type-Options: nosniff
    < X-Frame-Options: deny
    < X-Github-Enterprise-Version: 3.8.4
    < X-Github-Media-Type: github.merge-info-preview; param=nebula-preview; format=json
    < X-Github-Request-Id: ...
    < X-Oauth-Client-Id: ...
    < X-Oauth-Scopes: gist, read:org, repo, workflow
    < X-Ratelimit-Limit: 5000
    < X-Ratelimit-Remaining: 5000
    < X-Ratelimit-Reset: 1689628074
    < X-Ratelimit-Resource: graphql
    < X-Ratelimit-Used: 0
    < X-Runtime-Rack: 0.065463
    < X-Xss-Protection: 0
    
    {
      "errors": [
        {
          "path": [
            "query PullRequestStatusChecks",
            "node",
            "... on PullRequest",
            "statusCheckRollup",
            "nodes",
            "commit",
            "statusCheckRollup",
            "contexts",
            "nodes",
            "... on CheckRun",
            "checkSuite",
            "workflowRun",
            "event"
          ],
          "extensions": {
            "code": "undefinedField",
            "typeName": "WorkflowRun",
            "fieldName": "event"
          },
          "locations": [
            {
              "line": 5,
              "column": 274
            }
          ],
          "message": "Field 'event' doesn't exist on type 'WorkflowRun'"
        }
      ]
    }
    
    * Request took 102.166791ms
    GraphQL: Field 'event' doesn't exist on type 'WorkflowRun' (query PullRequestStatusChecks.node.... on PullRequest.statusCheckRollup.nodes.commit.statusCheckRollup.contexts.nodes.... on CheckRun.checkSuite.workflowRun.event)
    
  3. samcoe commented on Jul 17, 2023

    @samcoe
    Contributor

    @danxg87 Ah I see the issue. The field event does not exist due to your version of GHES. My change #7618 did not take GHES into account. I will work on a fix for this.

  4. added
    priority-2Affects more than a few users but doesn't prevent core functions
    and removed on Jul 18, 2023
  5. danxg87 commented on Jul 18, 2023

    @danxg87
    Author

    Ah thanks so much! This is an organizational appliance; I don't have say in maintaining/updating it unfortunately :( For now I've pinned our gh version to the 2.31.0 release and our workflows are back to normal. I'll be sure to bring this issue up with that team so they're aware. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority-2Affects more than a few users but doesn't prevent core functions

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions