“Resource not accessible by integration” when setting status as organisation


#1

I was writing a small integration for github (https://github.com/ligi/kontinuum) which works fine when using with the user that I created it with. Now I wanted to use this integration for an organisation - unfortunately I get the following error when trying to write a status for a commit:

{"message":"Resource not accessible by integration","documentation_url":"https://developer.github.com/v3"}

Reading the documentation there I do not see why writing a status should not work in this context. I think this might be a bug - posting this here as a first stage to a potential bug-report (anyone knows where to report github integration bugs?) and the search for a workaround.


#2

@ligi just to confirm is your installation is installed on the organization repository in question?


#3

Yes (If I understand the question correctly) - here a screenshot to maybe eliminate missunderstandings:


#4

Let me know if there is anything I can do to help find this issue - this is kinda blocking me currently with some things.


#5

Hey @ligi :wave: As far as I can tell, you didn’t give the installation access to the walleth/walleth repository. You only gave it access to two other repositories in the organization (walleth/walleth.github.com and walleth/app). Can you try re-configuring the installation of that integration on the organization and giving it access to the repository which contains the status you’re trying to access? Actually, looking a bit closer – I don’t even see a walleth/walleth repository in that organization. Can you share a screenshot of where you see the repository in that organization?


#6

I was moving walleth/walleth back to ligi/walleth as I wanted to have a working CI back for this project :wink:
But the same thing is true for ligi/walleth.github.com where you see I gave the permission:

problem executing repos/walleth/walleth.github.com/statuses/2c75cf95c48bbcded9c2db3b9c529ac1d44191a9 {"message":"Resource not accessible by integration","documentation_url":"https://developer.github.com/v3"}

Also currently I do not see any status indicators on the commits anymore - event for my main account where this was always working.


#7

But the same thing is true for ligi/walleth.github.com where you see I gave the permission:

problem executing repos/walleth/walleth.github.com/statuses/2c75cf95c48bbcded9c2db3b9c529ac1d44191a9

Just to make sure I understand – are you referring to ligi/walleth.github.com or walleth/walleth.github.com? What you wrote indicates the former, but the error message indicates the latter.

I’m going to assume that the error message is referring to the correct repository. With that in mind, can you clarify with what kind of token you’re creating those statuses? Are you using a user token (obtained via this flow https://developer.github.com/early-access/integrations/user-identification-authorization/#identifying-users-on-your-site) or an installation token (obtained via this flow: https://developer.github.com/early-access/integrations/authentication/#as-an-installation)? If you’re using a user token – does that user have write access to the repository?

Also currently I do not see any status indicators on the commits anymore - event for my main account where this was always working.

That’s unrelated to Integrations – you’ll see the same behavior regardless of how the statuses are created, is that correct?


#8

Yes - I mean wallet/walleth.github.com (sorry for the confusion - but I did not yet have my first tea and was excited that someone is having a real look into this and wanted to answer fast)
I obtain the token this way: https://developer.github.com/early-access/integrations/authentication/#as-an-installation
The status-not-showing issue is unrelated to integrations - I do not see statuses at all anymore - not on my repos - not on others where they where before. Should I report this at another place as this is about integrations?


#9

Yes - I mean wallet/walleth.github.com (sorry for the confusion - but I did not yet have my first tea and was excited that someone is having a real look into this and wanted to answer fast)

Apology accepted. :slight_smile:

I obtain the token this way: https://developer.github.com/early-access/integrations/authentication/#as-an-installation

As far as I can tell from our logs, you used an installation token for the installation of that integration on your personal account (ligi) not for the installation of that integration on the walleth organization (which owns the repository). Can you try using an installation token created for the installation on the walleth organization? The installation on your user account doesn’t have access to the repositories in the organization.

The status-not-showing issue is unrelated to integrations - I do not see statuses at all anymore - not on my repos - not on others where they where before. Should I report this at another place as this is about integrations?

You should report non-Integrations related problems and questions via our contact form: https://github.com/contact


#10

Ah now I see - thanks so much. I thought as my account owns this organisation it should have the permissions and I do not need an extra token. I think then we can consider this mystery solved - thanks again and keep up the good work!


#11

Hello! I am having the exact same problem.
I have a private repository, and my GitHub App is trying to get the readme content.
The GitHub App has Repository contents set to read and write for all repositories.

GET /repos/:owner/:repo/readme

But I am getting this: {“message”:“Resource not accessible by integration”,“documentation_url”:“https://developer.github.com/v3/repos/contents/#get-the-readme”} message with the above get command.

Any advice would be awesome!

Thank you so much :slight_smile:


#12

@shivangipatwardhan20 see my comment in Unable to list user repositories (or any other API call other than /user).


#13

i am getting the same error but with private repos only in the organization

13:22:45.823Z ERROR event: {"message":"Resource not accessible by integration","documentation_url":"https://developer.github.com/enterprise/2.13/v3/repos/contents/#get-contents"} (id=77827960-9ca0-11e8-8fc7-3a145c78ba63)
  HttpError: {"message":"Resource not accessible by integration","documentation_url":"https://developer.github.com/enterprise/2.13/v3/repos/contents/#get-contents"}
      at response.text.then.message (/request-info/node_modules/@octokit/rest/lib/request/request.js:78:19)
      at <anonymous>
      at process._tickDomainCallback (internal/process/next_tick.js:228:7)
  --
  event: {
    "id": "77827960-9ca0-11e8-8fc7-3a145c78ba63",
    "event": "pull_request.opened",
    "repository": "xxxxxxxxx/yyy",
    "installation": 9
  }