octokit.graphql.net icon indicating copy to clipboard operation
octokit.graphql.net copied to clipboard

API Token not allowing issue update

Open IEvangelist opened this issue 4 years ago • 7 comments

I have an Azure function that handles a GitHub webhook invocation for issues and pull requests. When it fires, I add a label and a reaction -- those both work perfectly. I then try to update either the title or body text of the issue or pull request and it fails.

Here is the StackTrace:

Error while attempting to filter issue: Object reference not set to an instance of an object.
   at Octokit.GraphQL.Core.Deserializers.ResponseDeserializer.DeserializeException(JToken error)
   at Octokit.GraphQL.Core.Deserializers.ResponseDeserializer.DeserializeExceptions(JArray errors)
   at Octokit.GraphQL.Core.Deserializers.ResponseDeserializer.Deserialize[TResult](Func`2 deserialize, JObject data)
   at Octokit.GraphQL.Core.Deserializers.ResponseDeserializer.Deserialize[TResult](Func`2 deserialize, String data)
   at Octokit.GraphQL.Core.SimpleQuery`1.Runner.RunPage(CancellationToken cancellationToken)
   at Octokit.GraphQL.ConnectionExtensions.Run[T](IConnection connection, ICompiledQuery`1 query, Dictionary`2 variables, CancellationToken cancellationToken)
   at IEvangelist.GitHub.Services.GraphQL.GitHubGraphQLClient.UpdateIssueAsync(UpdateIssueInput input) in C:\Users\dapine\source\repos\IEvangelist.GitHub.ProfanityFilter\IEvangelist.GitHub.Services\GraphQL\GitHubGraphQLClient.cs:line 116
   at IEvangelist.GitHub.Services.Handlers.IssueHandler.HandleIssueAsync(IssueEventPayload payload) in C:\Users\dapine\source\repos\IEvangelist.GitHub.ProfanityFilter\IEvangelist.GitHub.Services\Handlers\IssueHandler.cs:line 89

Here is the source code:

https://github.com/IEvangelist/GitHub.ProfanityFilter

Issue handler, invocation to client Client, invocation to connection with mutation

I'm using an API Token that was just newly created, why would this not work?

IEvangelist avatar Aug 30 '19 14:08 IEvangelist

I discovered that this must be a bug with the GraphQL implementation, as I converted over to using the REST based API and it worked. Here is the change

IEvangelist avatar Aug 30 '19 16:08 IEvangelist

Error while attempting to filter issue: Object reference not set to an instance of an object.

@IEvangelist my psychic debugger thinks there's something weird with how it's deserializing the response. Are you able to extract the query and create a failing test so the maintainers can see the same problem themselves more easily?

shiftkey avatar Aug 30 '19 17:08 shiftkey

Running into same stack trace of this issue and the capability is not available through v3 api. It states during the deserialization "message": "Something went wrong while executing your query. Please include C8E9:02B3:296A2D:314CBC:5D816400 when reporting this issue."

brianaj avatar Sep 17 '19 22:09 brianaj

Hi @brianaj, thanks for sharing! I'm happy that someone else is seeing this too.

I have literally been buried, and it's been extremely difficult to find time to look into this. My workaround was to simply use the Octokit.Net SDK to update the issue since the GraphQL implementation for mutating an issue is clearly broken. It worked and I moved on, I would like to come back to this though. It should be very easy for someone to recreate. Simply try to update an issue using the GraphQL mutation.

For my project, this is the change that I included to get this working... again, simply using both SDKs side-by-side... which doesn't feel good but it works for now.

https://github.com/IEvangelist/GitHub.ProfanityFilter/commit/50dae788eba18655a72985e72b9dc0e6236981b1#diff-bfef6a25cdd5583e892f47c982da2959

IEvangelist avatar Sep 18 '19 12:09 IEvangelist

Error while attempting to filter issue: Object reference not set to an instance of an object.

@IEvangelist my psychic debugger thinks there's something weird with how it's deserializing the response. Are you able to extract the query and create a failing test so the maintainers can see the same problem themselves more easily?

That isn't a terrible idea, however; I'm not sure how I'd be able to extract the response as it is buried in the internals of the ConnectionExtensions. In other words, when my function fires - it correctly deserializes the issue event payload and then uses that to create an issue update mutation. This mutation is then executed against the internals of the connection, and the response occurs within there. I'm not able to capture that...

IEvangelist avatar Sep 18 '19 13:09 IEvangelist

Hi @brianaj, thanks for sharing! I'm happy that someone else is seeing this too.

I have literally been buried, and it's been extremely difficult to find time to look into this. My workaround was to simply use the Octokit.Net SDK to update the issue since the GraphQL implementation for mutating an issue is clearly broken. It worked and I moved on, I would like to come back to this though. It should be very easy for someone to recreate. Simply try to update an issue using the GraphQL mutation.

For my project, this is the change that I included to get this working... again, simply using both SDKs side-by-side... which doesn't feel good but it works for now.

IEvangelist/GitHub.ProfanityFilter@50dae78#diff-bfef6a25cdd5583e892f47c982da2959

Thanks for the response @IEvangelist. Yes, unfortunately, we are using beta functionality that is not available in the rest client. We are just using graphql client directly for now.

brianaj avatar Sep 19 '19 01:09 brianaj

👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

github-actions[bot] avatar Dec 03 '22 01:12 github-actions[bot]