Something went wrong while executing your query - requestReviews


#1

I’m having two issues with POSTing a requestReviews mutation.

The first is when I try posting with a numerical pull request ID I get an error (this is the ID of the pull request that I grab from a webhook).

This is the query:

mutation {
  requestReviews(input:{
    pullRequestId: 172372979,
    userIds: 7562272
  }){
    requestedReviewersEdge {
      node {
        login
      }
    }
  }
}

This is the error: Could not resolve to a node with the global id of '172372979'

So I tried querying the API again to get the hashed ID to pass through but I got a different error:

Query:

mutation {
  requestReviews(input:{
    pullRequestId: MDExOlB1bGxSZXF1ZXN0MTcyMzcyOTc5,
    userIds: MDQ6VXNlcjIyNzc4MzE0
  }){
    requestedReviewersEdge {
      node {
        login
      }
    }
  }
}

Error: Something went wrong while executing your query. Please include7C10:7221:1D17E1E:354705A:5A997928when reporting this issue.

Even though that error message shows, it looks like the mutation has worked since when checking the PR, a user does get assigned to it.

Does anyone have any idea what might be the issue? Ideally, I’d like to be able to POST the mutation with the numerical IDs so that I don’t have to hit the API again just to get the hashed values.


#2

:wave: @maidoesthings,

The IDs that the requestReviews mutation is looking for here are the “node IDs” which come from GraphQL (and you used in your second query). Unfortunately we don’t expose those IDs in webhook payloads, but if you’re ever hitting the REST API, you can determine them from the node_id attribute. More information can be found here.

This is indeed a problem on our end. I’ve submitted an internal issue to look into this. We’ll update you here when we have more information to share, but I think you might be able to get around this by using an inline fragment like this:

mutation {
  requestReviews(input:{
    pullRequestId: MDExOlB1bGxSZXF1ZXN0MTcyMzcyOTc5,
    userIds: MDQ6VXNlcjIyNzc4MzE0
  }){
    requestedReviewersEdge {
      node {
        ... on User {
          login
        }
      }
    }
  }
}

Please give that a try and let me know if it helps :crossed_fingers:.


#3

Hi @bswinnerton!

That’s good to know. I guess I was confused because the ID documentation said we were allowed to pass in a string or int for the ID -
(https://developer.github.com/v4/scalar/id/), but maybe that’s for a different case.

I tried the query you gave but got the same result :frowning: . I’ll figure some way around this until it gets fixed.

Thank you so much for your help :smiley:!