Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Troubles posting comment to a pull request using GitHub app API #1030

Closed
ondrejmirtes opened this issue Sep 23, 2018 · 7 comments
Closed

Troubles posting comment to a pull request using GitHub app API #1030

ondrejmirtes opened this issue Sep 23, 2018 · 7 comments

Comments

@ondrejmirtes
Copy link

Hello,
I am trying to post a comment to a pull request on behalf of GitHub app and I get this error:

Could not resolve to a node with the global id of 'MDExOlB1bGxSZXF1ZXN0MjE3NTE5NzYw'

I enabled debug messages in Octokit, so this is the full output:

Posting comment to PR #8073
  octokit:rest REQUEST: { timeout: 0,
  agent: undefined,
  method: 'post',
  url: 'https://api.github.com/repos/slevomat/slevomat/issues/8073/comments',
  headers:
   { accept: 'application/vnd.github.squirrel-girl-preview',
     'user-agent': 'octokit/rest.js v15.11.4',
     authorization: 'token xxx },
  body:
   { body: 'Foo' } } +583ms
{ {"message":"Validation Failed","errors":[{"resource":"IssueComment","code":"unprocessable","field":"data","message":"Could not resolve to a node with the global id of 'MDExOlB1bGxSZXF1ZXN0MjE3NTE5NzYw'."}],"documentation_url":"https://developer.github.com/v3/issues/comments/#create-a-comment"}

The code looks like this:

await appInstallation.issues.createComment({
	owner: payload.repository.owner.name,
	repo: payload.repository.name,
	number: pullRequest.number,
	body: 'Foo',
});

I checked that I have both PR and issues write permissions. What am I doing wrong?

@gr2m gr2m added the question label Sep 24, 2018
@gr2m
Copy link
Contributor

gr2m commented Sep 24, 2018

This all looks right to me 🤔

Could you try a curl command?

curl -X POST -H "Accept: application/vnd.github.squirrel-girl-preview" -H"Authorization: token xxx" https://api.github.com/repos/slevomat/slevomat/issues/8073/comments -d '{"body": "foo"}'

If that gives you the same result, can you send the curl command with the error message to support? https://github.com/support They will forward it to the API team. Support is great and very responsive :)

@ondrejmirtes
Copy link
Author

Yes, it's a problem with their API, the support responded to me that they are working to it and that meanwhile I can fix it with "repository metadata" permissions :) Thank you!

@JJ
Copy link

JJ commented Oct 23, 2019

Is this fixed now?

@gr2m
Copy link
Contributor

gr2m commented Oct 23, 2019

@JJ make sure your app have read access to the repository metadata permission. It will save you a lot of headache.

@JJ
Copy link

JJ commented Oct 23, 2019

@gr2m It does have. The problem is that apparently no one without write access to the repository can't create anything there. This causes actions/first-interaction#10, for instance, as well as actions/labeler#12. I wouldn't say this is a feature, but looks more like a bug.

@gr2m
Copy link
Contributor

gr2m commented Oct 23, 2019

That sounds it's an unrelated issue. The original issue was about a GitHub App, the issues you linked are about GitHub Actions?

@JJ
Copy link

JJ commented Oct 23, 2019

Right, the error message is different. Thanks for answering anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants