Unable to configure Google OAuth provider


I have worked Sentry 9.1.0 example, that works with docker-compose. And authentication uses Google OAuth (via sentry-auth-google package)
Now, I want to setup Sentry 9.1.1.

I copied my docker-compose.yml to another dir, changed image tag in Dockerfile, (I use onbuild version, because I put config.yml and sentry.conf.py to image) Also, I disabled installation sentry-auth-google via pip during image building.

After init migrations, I logged in and saw warning, that GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET were deprecated.
So, I deleted them from sentry.conf.py and added to config.yml:
auth-google.client-id: ‘***’
auth-google.client-secret: ‘***’

Then, I reinstalled sentry, reran migrations, logged in and went to http://sentry.myhost.com/organizations/sentry/auth, I pressed to configure button in front of google icon, I was redirected to google login page. After successful logging in I got an standard error
Oops! Something went wrong..and so on
In web container I see next error:

web_1        | 11:57:37 [INFO] sentry.superuser: superuser.request (user_id=1 url=u'http://sentry.myhost.com/organizations/sentry/auth/configure/' ip_address=u'' method=u'GET')
web_1        | Traceback (most recent call last):
web_1        |   File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response
web_1        |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
web_1        |   File "/usr/local/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
web_1        |     return self.dispatch(request, *args, **kwargs)
web_1        |   File "/usr/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 57, in wrapped_view
web_1        |     return view_func(*args, **kwargs)
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/web/frontend/base.py", line 225, in dispatch
web_1        |     return self.handle(request, *args, **kwargs)
web_1        |   File "/usr/local/lib/python2.7/site-packages/django/db/transaction.py", line 371, in inner
web_1        |     return func(*args, **kwargs)
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/web/frontend/organization_auth_settings.py", line 186, in handle
web_1        |     auth_provider=auth_provider,
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/web/frontend/organization_auth_settings.py", line 138, in handle_existing_provider
web_1        |     'provider': provider,
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/plugins/base/response.py", line 37, in render
web_1        |     return render_to_string(self.template, context, request)
web_1        |   File "/usr/local/lib/python2.7/site-packages/sentry/web/helpers.py", line 115, in render_to_string
web_1        |     return loader.render_to_string(template, context)
web_1        |   File "/usr/local/lib/python2.7/site-packages/django/template/loader.py", line 162, in render_to_string
web_1        |     t = get_template(template_name)
web_1        |   File "/usr/local/lib/python2.7/site-packages/django/template/loader.py", line 138, in get_template
web_1        |     template, origin = find_template(template_name)
web_1        |   File "/usr/local/lib/python2.7/site-packages/django/template/loader.py", line 131, in find_template
web_1        |     raise TemplateDoesNotExist(name)
web_1        | TemplateDoesNotExist: sentry_auth_google/configure.html
web_1        | 11:57:37 [ERROR] django.request: Internal Server Error: /organizations/sentry/auth/configure/ (status_code=500 request=<WSGIRequest: GET u'/organizations/sentry/auth/configure/'>)
web_1        | - - [05/Jun/2019:11:57:37 +0000] "GET /organizations/sentry/auth/configure/ HTTP/1.1" 500 7349 "http://sentry.myhost.com/settings/sentry/auth/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"

The root is TemplateDoesNotExist: sentry_auth_google/configure.html

Previously, this file was a part of sentry-auth-google package. But currently I cannot find this file at filesystem, but still see references to it here https://github.com/getsentry/sentry/blob/9.1.1/src/sentry/auth/providers/google/views.py#L75.

What I should do to make it work and configure my auth provider?


oauth2 - 1.9.0.post1
oauthlib - 3.0.1

I have the same exact issue with my onprem install. Is this just a bug?

The file lives here so it may just be a path issue: https://github.com/getsentry/sentry/blob/9.1.1/src/sentry/auth/providers/google/templates/sentry_auth_google/configure.html

The reason seems to be https://github.com/getsentry/sentry/blob/9.1.1/MANIFEST.in not including a pattern to capture this file so it does not exist in the installed package. I’ll try to fix it and then backport to 9.x releases.

1 Like

In 9.1 we bundle Google natively.

  • You can pip uninstall sentry-auth-google.
  • ‘sentry.auth.providers.google’ must be in INSTALLED_APPS
  • ‘django.template.loaders.app_directories.Loader’ must be in TEMPLATE_LOADERS

Never mind somehow I missed @BYK’s last reply which seems to be the actual problem.

1 Like

Thanks a lot for fix. When will you add this to next minor release?

@Serg - We’ll start looking into a patch release soon. It should be out in a few weeks. In the meantime, if you have the chance, you can simply copy the missing folder into the install location for a workaround if this is an urgent matter for you.