sentry-auth-gitlab icon indicating copy to clipboard operation
sentry-auth-gitlab copied to clipboard

Plugin does not work with newest sentry version of Sentry On-Premise Docker setup

Open RhinigtasSalvex opened this issue 5 years ago • 5 comments

After installing plugin via adding sentry-auth-gitlab to requirements.txt and rebuilding. The web, worker, cron and post-process docker containers are constantly restarting.

The docker logs for the web service give this error:

Traceback (most recent call last):
File "/usr/local/bin/sentry", line 8, in <module>
  sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/sentry/runner/__init__.py", line 164, in main
  cli(prog_name=get_prog(), obj={}, max_content_width=100)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
  return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 697, in main
  rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
  return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
  return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
  return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
  return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
  return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/sentry/runner/decorators.py", line 68, in inner
  return ctx.invoke(f, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
  return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
  return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/sentry/runner/decorators.py", line 29, in inner
  configure()
File "/usr/local/lib/python2.7/site-packages/sentry/runner/__init__.py", line 127, in configure
  configure(ctx, py, yaml, skip_service_validation)
File "/usr/local/lib/python2.7/site-packages/sentry/runner/settings.py", line 158, in configure
  skip_service_validation=skip_service_validation,
File "/usr/local/lib/python2.7/site-packages/sentry/runner/initializer.py", line 308, in initialize_app
  django.setup()
File "/usr/local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
  apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
  app_config = AppConfig.create(entry)
File "/usr/local/lib/python2.7/site-packages/django/apps/config.py", line 94, in create
  module = import_module(entry)
File "/usr/local/lib/python2.7/importlib/__init__.py", line 37, in import_module
  __import__(name)
File "/usr/local/lib/python2.7/site-packages/sentry_auth_gitlab/__init__.py", line 5, in <module>
  from .provider import GitLabOAuth2Provider
File "/usr/local/lib/python2.7/site-packages/sentry_auth_gitlab/provider.py", line 3, in <module>
  from sentry.auth.providers.oauth2 import (
File "/usr/local/lib/python2.7/site-packages/sentry/auth/providers/oauth2.py", line 9, in <module>
  from sentry.auth.provider import Provider
File "/usr/local/lib/python2.7/site-packages/sentry/auth/provider.py", line 6, in <module>
  from .view import ConfigureView
File "/usr/local/lib/python2.7/site-packages/sentry/auth/view.py", line 5, in <module>
  from sentry.plugins.base.view import PluggableViewMixin
File "/usr/local/lib/python2.7/site-packages/sentry/plugins/base/__init__.py", line 3, in <module>
  from .bindings import BindingManager
File "/usr/local/lib/python2.7/site-packages/sentry/plugins/base/bindings.py", line 5, in <module>
  from sentry.plugins import providers
File "/usr/local/lib/python2.7/site-packages/sentry/plugins/providers/__init__.py", line 5, in <module>
  import_submodules(globals(), __name__, __path__)
File "/usr/local/lib/python2.7/site-packages/sentry/utils/imports.py", line 45, in import_submodules
  module = __import__(module_name, globals(), locals(), ["__name__"])
File "/usr/local/lib/python2.7/site-packages/sentry/plugins/providers/base.py", line 7, in <module>
  from social_auth.models import UserSocialAuth
File "/usr/local/lib/python2.7/site-packages/social_auth/models.py", line 12, in <module>
  from .fields import JSONField
File "/usr/local/lib/python2.7/site-packages/social_auth/fields.py", line 10, in <module>
  from sentry.db.models.utils import Creator
File "/usr/local/lib/python2.7/site-packages/sentry/db/models/__init__.py", line 3, in <module>
  from .base import *  # NOQA
File "/usr/local/lib/python2.7/site-packages/sentry/db/models/base.py", line 37, in <module>
  class BaseModel(models.Model):
File "/usr/local/lib/python2.7/site-packages/django/db/models/base.py", line 110, in __new__
  app_config = apps.get_containing_app_config(module)
File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 247, in get_containing_app_config
  self.check_apps_ready()
File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 125, in check_apps_ready
  raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

it seems to me that the plugin isn't compatible anymore with the django version used in sentry?

RhinigtasSalvex avatar Feb 05 '20 14:02 RhinigtasSalvex

no activity for 14 days - did you possibly find a solution ?

sgohl avatar Feb 19 '20 19:02 sgohl

no activity for 14 days - did you possibly find a solution ? No, without support from the dev I gave up on it, since it's just a nice to have feature.

RhinigtasSalvex avatar Feb 21 '20 09:02 RhinigtasSalvex

it seems to me that the plugin isn't compatible anymore with the django version used in sentry?

That is exactly the case here.

I made it to work for our on premise installation in my fork https://github.com/cirmaciu/sentry-auth-gitlab There is big BUT though. I am not python developer. I just changed files so the plugin works. It is not tested at all and plugin has to be installed locally.

I would be happy if anyone could get inspired there and make it to actual pull request here.

cirmaciu avatar Feb 27 '20 17:02 cirmaciu

I just tested it - basically, the Gitlab<->Sentry connection works again, the Login Page now provides the Button/Link to Gitlab – there you login with your user account, and the callback/redirect back to Sentry also works, BUT

Within Sentry, I am magically logged in as superuser, and no account has been created for me (me speaking as the user which I logged into Gitlab).

I have deleted all users and members. The superuser is the only account left, which has a completely different email address.

I did that whole testing in inkognito chromium to eliminate cookie/session problems.

Do you encounter the same situation?

Wasn't there an option to create users automatically after successful login if no account exists?

sgohl avatar May 20 '20 18:05 sgohl

are you sure ??? I followed the author's steps but could not achieve it, can you share your operation?

Lq-grandstream avatar Dec 02 '22 09:12 Lq-grandstream