Github integration problem

Hi! I am trying to set up github integration with sentry according to this doc:

When I click Install on github application setup, I see screen with 500 error. Logs looks like:

sentry_1    | 16:37:48 [INFO] sentry.superuser: superuser.request (user_id=1 url=u'https://hostname/extensions/github/setup/?installation_id=xxxxx&setup_action=install' ip_address=u'xx.xx.xx.xx' method=u'GET')
sentry_1    | 16:37:48 [INFO] sentry.identity: identity.token-exchange-error (pipeline_state=u'xxx' error=u'invalid_state')

In my config.yml I have:

github-app.id: 12345
github-app.name: 'sentry-apptest'
github-app.private-key: "key here"
github-app.client-id: 'clientid'
github-app.client-secret: 'secret'

What is the best way to debug and fix this error?

Can you provide more details around at which step this issue happens?

Also giving more details about your Sentry instance like its version, whether you are using our on-premise repo or a custom installation, whether you are using HTTPS etc. would all help.

Hi! This happens right after I click ‘Install’ in github app popup window. I see error in browser and error in logs.

I do use SSL, in my config I have env SENTRY_USE_SSL=1.
I run with docker-compose with ‘image: sentry’.
I use nginx as proxy and manage certs with lets encrypt. Nginx config is from official docs.

After this error github app is installed on the account, but in sentry there are no integrations installed.

What else should I add?

@BYK Any ideas?

I’ve seen this happen when the hostnames used for integration and actual hostnames assumed by the services does not match, for example you connect to sentry via CNAME, or shortned name that is in the search path (http://sentry oppose to http://sentry.company.internal).

This can also happen if one side uses TLS, and the other one doesn’t, or the certs cannot be validated.

1 Like

How can I debug this? Where I can set or at least see this name?
Certs are from LE and handled by nginx.

I manually had to modify the python code to dump out the response body to see what the issue was.

Could you please tell me few tricks about it? Not so experienced with python.

I suggested a few things to check first, verify they do not fix the problem.

Thing is I have no idea how to check these things. Any advices on how to check them?

maybe any other useful thought about how to find the problem?

You should be able to see some key system settings from the UI by visiting http://localhost:9000/settings/sentry/ (replace the host name and port with yours).

All other settings should be visible in your config.yml and sentry.conf.py files: https://docs.sentry.io/server/config/

I checked everything, but problem is I cant figure out why it’s not working. And error log does not describe any information.
Any ideas how to further debug it?

Got any success on github integration?
Coz i’m also stuck in it.

No, and it looks like there are no support here :frowning:

yeah, looks like it.

If you can be more specific about what you checked and what you expected things to be, we may be able to provide more help. You may also try setting the logging level to DEBUG and see if it provides more helpful information: https://docs.sentry.io/server/config/#logging

Also the code that checks the state is here: https://github.com/getsentry/sentry/blob/4aa70bb4c25667c48ed1657767f611b05a92e40c/src/sentry/identity/oauth2.py#L309

You may wanna add some more logging there to see what the compared states are which may give you a clue.