GitHub integration throws exception on GET /api/0/organizations/:org/repos

Struggling to understand why we can install the GitHub application, but when going to configure, the Sentry logs show an error in the python code. Here are our logs:

172.19.0.1 - - [09/Oct/2020:17:26:40 +0000] "GET /api/0/organizations/vsp/config/integrations/ HTTP/1.1" 200 14670 "http://sentry10.vfs.va.gov/extensions/external-install/github/12303497/" "Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0"
172.19.0.1 - - [09/Oct/2020:17:26:40 +0000] "GET /organizations/vsp/integrations/github/setup/?installation_id=12303497 HTTP/1.1" 200 7158 "http://sentry10.vfs.va.gov/extensions/external-install/github/12303497/" "Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0"
172.19.0.1 - - [09/Oct/2020:17:26:42 +0000] "GET /api/0/organizations/vsp/?detailed=1 HTTP/1.1" 200 14877 "http://sentry10.vfs.va.gov/settings/vsp/integrations/github/21/" "Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0"
172.19.0.1 - - [09/Oct/2020:17:26:42 +0000] "GET /_static/1602264314/sentry/dist/ConfigureIntegration~OrganizationRepositories.js HTTP/1.1" 200 5720 "http://sentry10.vfs.va.gov/settings/vsp/integrations/github/21/" "Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0"
172.19.0.1 - - [09/Oct/2020:17:26:42 +0000] "GET /api/0/organizations/vsp/broadcasts/ HTTP/1.1" 200 948 "http://sentry10.vfs.va.gov/settings/vsp/integrations/github/21/" "Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0"
172.19.0.1 - - [09/Oct/2020:17:26:42 +0000] "GET /_static/1602264314/sentry/dist/ConfigureIntegration.js HTTP/1.1" 200 8821 "http://sentry10.vfs.va.gov/settings/vsp/integrations/github/21/" "Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0"
172.19.0.1 - - [09/Oct/2020:17:26:43 +0000] "GET /api/0/organizations/vsp/config/integrations/ HTTP/1.1" 200 14670 "http://sentry10.vfs.va.gov/settings/vsp/integrations/github/21/" "Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0"
172.19.0.1 - - [09/Oct/2020:17:26:43 +0000] "GET /api/0/organizations/vsp/integrations/21/ HTTP/1.1" 200 1839 "http://sentry10.vfs.va.gov/settings/vsp/integrations/github/21/" "Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0"
172.19.0.1 - - [09/Oct/2020:17:26:43 +0000] "GET /api/0/organizations/vsp/repos/?status= HTTP/1.1" 200 1251 "http://sentry10.vfs.va.gov/settings/vsp/integrations/github/21/" "Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0"
  File "/usr/local/lib/python2.7/site-packages/sentry/api/endpoints/organization_integration_repos.py", line 39, in get
  File "/usr/local/lib/python2.7/site-packages/sentry/integrations/github/integration.py", line 101, in get_repositories
  File "/usr/local/lib/python2.7/site-packages/sentry/integrations/github/client.py", line 42, in get_repositories
  File "/usr/local/lib/python2.7/site-packages/sentry/integrations/client.py", line 236, in get
  File "/usr/local/lib/python2.7/site-packages/sentry/integrations/github/client.py", line 74, in request
  File "/usr/local/lib/python2.7/site-packages/sentry/integrations/github/client.py", line 93, in get_token
  File "/usr/local/lib/python2.7/site-packages/sentry/integrations/github/client.py", line 110, in create_token
  File "/usr/local/lib/python2.7/site-packages/sentry/integrations/client.py", line 242, in post
  File "/usr/local/lib/python2.7/site-packages/sentry/integrations/github/client.py", line 78, in request
  File "/usr/local/lib/python2.7/site-packages/sentry/integrations/client.py", line 220, in _request
172.19.0.1 - - [09/Oct/2020:17:26:43 +0000] "GET /api/0/organizations/vsp/integrations/21/repos/ HTTP/1.1" 500 622 "http://sentry10.vfs.va.gov/settings/vsp/integrations/github/21/" "Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0"

GitHub app settings:

User authorization callback URL: $url/extensions/github/setup
NO Request user authorization
Setup URL: $url/extensions/github/setup/
NO Redirect on update
Webhook Active, url: $url/extensions/github/webhook
SSL Enabled

The application can be installed, but when going to configure, while tailing the logs, we see the 500 on GET /api/0/organizations/:org/repos

Any suggestions? Looks like all our configuration files are set correctly.

Could it be that Sentry server failing to communicate with GitHub due to some firewall settings? Since your logs cut off the error message of the stacktrace, it is hard to say more.

Also, have you followed this guide: https://develop.sentry.dev/self-hosted/sso/#github-auth (or figured this out yourself from the config files?)

Interesting. I am exploring the network connectivity issue, but the guide you linked suggests (to me) there is only one configuration needed for a single GitHub application, for both OAuth && repository integration?

We have a GitHub OAuth application which is working as expected, users are able to login. But this did nothing for the GitHub repos integration itself.

Will update with more when I discover.

@kfrz - we normally require 2 separate apps: one, an OAuth application for supporting logins and one GitHub App for repo integration. That said since on self-hosted in single organization mode GitHub Apps can be used for SSO by granting them organization access, we made the guide and the configuration simpler for this case, combining both.

Happy to help if you are still having issues.

This seems to be a result of running v10.0.1, fixed when upgrading to v20.7.0 as seen here Sentry using a deprecated GitHub API endpoint

Thank you! Can mark this as solved/closed.