Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3rd party plugins integration support still possible? #347

Closed
1 of 3 tasks
max-wittig opened this issue Jan 13, 2020 · 19 comments
Closed
1 of 3 tasks

3rd party plugins integration support still possible? #347

max-wittig opened this issue Jan 13, 2020 · 19 comments
Assignees

Comments

@max-wittig
Copy link
Contributor

max-wittig commented Jan 13, 2020

Important Details

How are you running Sentry?

  • On-Premise docker [Version 10]
  • Saas (sentry.io)
  • Other [briefly describe your environment]

Description

Plugins like sentry-auth-oidc don't seem to work anymore with sentry 10. Is it still possible to install 3rd party plugins?

Steps to Reproduce

  1. Install sentry 10
  2. Add sentry auth oidc
  3. Notice 500, when trying to login

Good items to include here include:

sh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36"
web_1 | Traceback (most recent call last):
web_1 | File "/usr/local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 42, in inner
web_1 | response = get_response(request)
web_1 | File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
web_1 | response = self._get_response(request)
web_1 | File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
web_1 | response = self.process_exception_by_middleware(e, request)
web_1 | File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, 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 68, 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 58, 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 227, in dispatch
web_1 | return self.handle(request, *args, **kwargs)
web_1 | File "/usr/local/lib/python2.7/site-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func
web_1 | response = view_func(request, *args, **kwargs)
web_1 | File "/usr/local/lib/python2.7/site-packages/django/utils/decorators.py", line 185, in inner
web_1 | return func(*args, **kwargs)
web_1 | File "/usr/local/lib/python2.7/site-packages/sentry/web/frontend/auth_organization_login.py", line 72, in handle
web_1 | response = self.handle_sso(request, organization, auth_provider)
web_1 | File "/usr/local/lib/python2.7/site-packages/sentry/web/frontend/auth_organization_login.py", line 35, in handle_sso
web_1 | provider = auth_provider.get_provider()
web_1 | File "/usr/local/lib/python2.7/site-packages/sentry/models/authprovider.py", line 51, in get_provider
web_1 | return manager.get(self.provider, **self.config)
web_1 | File "/usr/local/lib/python2.7/site-packages/sentry/auth/manager.py", line 23, in get
web_1 | raise ProviderNotRegistered(key)
web_1 | ProviderNotRegistered: oidc
web_1 | 15:24:15 [ERROR] django.request: Internal Server Error: /auth/login/org/ (status_code=500 request=<WSGIRequest: GET u'/auth/login/org/'>)
web_1 | 172.21.0.21 - - [13/Jan/2020:15:24:13 +0000] "GET /auth/login/org/ HTTP/1.0" 500 5321 "https://someurl/auth/login/org" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36"

What you expected to happen

Login should work

Possible Solution

Describe how to create plugins for sentry >= 10

@BYK BYK transferred this issue from getsentry/sentry Jan 13, 2020
@BYK
Copy link
Collaborator

BYK commented Jan 13, 2020

Yes it is. You should be able to put https://github.com/siemens/sentry-auth-oidc/archive/master.zip into sentry/requirements.txt file and rebuild your container for this to be installed.

@max-wittig
Copy link
Contributor Author

Thanks for your response. But would that change the behavior here, because the plugin is clearly installed?

@max-wittig
Copy link
Contributor Author

Additionally the data from 9 to 10 doesn't seem to be compatible ☹️

django.db.utils.ProgrammingError: UndefinedColumn('column sentry_organizationmember.inviter_id does not exist\nLINE 1: ... "sentry_organizationmember"."has_global_access", "sentry_or...\n ^\n',)
web_1 | SQL: SELECT "sentry_organizationmember"."id", "sentry_organizationmember"."organization_id", "sentry_organizationmember"."user_id", "sentry_organizationmember"."email", "sentry_organizationmember"."role", "sentry_organizationmember"."flags", "sentry_organizationmember"."token", "sentry_organizationmember"."date_added", "sentry_organizationmember"."token_expires_at", "sentry_organizationmember"."has_global_access", "sentry_organizationmember"."inviter_id", "sentry_organizationmember"."invite_status", "sentry_organizationmember"."type" FROM "sentry_organizationmember" INNER JOIN "sentry_organization" ON ("sentry_organizationmember"."organization_id" = "sentry_organization"."id") WHERE ("sentry_organization"."status" = %s AND "sentry_organizationmember"."user_id" IN (%s))
web_1 | 172.21.0.20 - - [14/Jan/2020:08:01:14 +0000] "GET / HTTP/1.0" 500 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36"

@max-wittig
Copy link
Contributor Author

@BYK I've done a clean install, but seems like the way sentry loads plugins has changed:

/providers/base.py", line 7, in ", " from social_auth.models import UserSocialAuth", " File "/usr/local/lib/python2.7/site-packages/social_auth/models.py", line 12, in ", " from .fields import JSONField", " File "/usr/local/lib/python2.7/site-packages/social_auth/fields.py", line 10, in ", " from sentry.db.models.utils import Creator", " File "/usr/local/lib/python2.7/site-packages/sentry/db/models/init.py", line 3, in ", " from .base import * # NOQA", " File "/usr/local/lib/python2.7/site-packages/sentry/db/models/base.py", line 37, in ", " class BaseModel(models.Model):", " File "/usr/local/lib/python2.7/site-packages/django/db/models/base.py", line 105, in new", " app_config = apps.get_containing_app_config(module)", " File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 237, in get_containing_app_config", " self.check_apps_ready()", " File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 124, in check_apps_ready", " raise AppRegistryNotReady("Apps aren't loaded yet.")", "django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet."]}

@max-wittig
Copy link
Contributor Author

The plugin does need to be changed and I found out how. I will publish the changes on sentry-auth-oidc soon for it to be compatible with sentry-10

@BYK
Copy link
Collaborator

BYK commented Jan 14, 2020

But would that change the behavior here, because the plugin is clearly installed?

Ehh, sorry I didn't look at the stack trace and just assumed you were asking how to install things. My bad :(

This looks like a migration-related issue to me. Tagging @scefali and @wedamija who may be able to provide more information on this.

@max-wittig
Copy link
Contributor Author

I figured it out. Seems like you need to configure your plugin to wait until django is ready, by using AppConfig and setting up the ready method.

@max-wittig
Copy link
Contributor Author

@BYK Here are the changes, I needed to make: siemens/sentry-auth-oidc@fc78569

@BYK
Copy link
Collaborator

BYK commented Jan 15, 2020

@max-wittig thanks a lot for sharing your solution! Do you think we can close the issue now?

@max-wittig
Copy link
Contributor Author

Yes, but I guess it should be documented better in sentry maybe?

@BYK
Copy link
Collaborator

BYK commented Jan 15, 2020

I thought a major revision indicated things may not be 100% backwards compatible. Do you think we should still say some plugins may stop working? There is also a note on 3rd-party plugins over at our documentation: https://docs.sentry.io/server/plugins/#rd-party-plugins

@max-wittig
Copy link
Contributor Author

@BYK Sure major version means things break. I haven't found a single plugin in the wild that still looks like it would work. Maybe remove this list (or add that it only works with sentry 9) and provide and example for sentry 10 instead?

@BYK BYK self-assigned this Jan 21, 2020
@chessracer
Copy link

We're using sentry v9.1.2, together with oidc + google auth via a keycloak provider
Now that google-auth-oidc defaults to v3.0.0 we started running into:

File "/usr/local/lib/python2.7/site-packages/oidc/apps.py", line 2, in
from django.apps import AppConfig
ImportError: No module named apps

Following some prior documentation on that integration, we were running
pip install sentry-auth-oidc in a command: block in docker-compose.
Instead, explicitly installing sentry-auth-oidc v2.1.0 works for us in conjunction with sentry:9.1.2

   command:
    - /bin/sh
    - -c
    - |
      sentry upgrade --noinput
      sentry createuser --email admin --password admin --superuser
      pip install --upgrade sentry-auth-oidc==2.1.0
      /entrypoint.sh run web

@github-actions
Copy link

github-actions bot commented Jan 4, 2021

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Accepted, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@github-actions
Copy link

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Accepted, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@omidraha
Copy link
Contributor

omidraha commented Mar 19, 2021

When we add third package like this to requirements.txt file,
Do we need to run install.sh again?
I tried docker-compose build , but I had some error for this.

Here is the log for sentry_telegram_py3 :
Here is log:

nginx_1                                     | - - [19/Mar/2021:21:45:22 +0000] "POST /api/2/store/ HTTP/1.1" 200 41 "-" "sentry-java/1.7.27-f6366" "-"
ingest-consumer_1                           | 21:45:23 [INFO] batching-kafka-consumer: Flushing 1 items (from {('ingest-events', 0): [455, 455]}): forced:False size:False time:True
ingest-consumer_1                           | 21:45:23 [INFO] batching-kafka-consumer: Worker flush took 29ms
snuba-transactions-consumer_1               | 2021-03-19 21:45:24,244 Completed processing <Batch: 1 message, open for 1.01 seconds>.
clickhouse_1                                | 2021.03.19 21:45:24.265931 [ 87 ] {2ce6bdb4-ec5d-48c2-b462-318d1e9553f7} <Information> executeQuery: Read 1 rows, 71.00 B in 0.030 sec., 33 rows/sec., 2.31 KiB/sec.
clickhouse_1                                | 2021.03.19 21:45:24.268294 [ 87 ] {} <Information> HTTPHandler: Done processing query
snuba-outcomes-consumer_1                   | 2021-03-19 21:45:24,271 Completed processing <Batch: 1 message, open for 1.04 seconds>.
clickhouse_1                                | 2021.03.19 21:45:24.310257 [ 88 ] {dcc25828-3f0a-4b1b-b684-837c4ff65964} <Information> executeQuery: Read 1 rows, 2.05 KiB in 0.076 sec., 13 rows/sec., 26.81 KiB/sec.
clickhouse_1                                | 2021.03.19 21:45:24.312895 [ 88 ] {} <Information> HTTPHandler: Done processing query
snuba-consumer_1                            | 2021-03-19 21:45:24,317 Completed processing <Batch: 1 message, open for 1.09 seconds>.
worker_1                                    | 21:45:25 [INFO] sentry.plugins.sentry_telegram_py3: notification.dispatched (event_id='ffeb6e08d9c9486da80c924f0db89e61' group_id=23 plugin='sentry_telegram_py3' rule_id=3 project_id=2)
snuba-subscription-consumer-transactions_1  | 2021-03-19 21:45:27,268 Flushing 1 items (from {Partition(topic=Topic(name='events'), index=0): Offsets(lo=4381, hi=4382)})
snuba-subscription-consumer-transactions_1  | 2021-03-19 21:45:27,271 Worker flush took 0ms
snuba-subscription-consumer-events_1        | 2021-03-19 21:45:27,591 Flushing 1 items (from {Partition(topic=Topic(name='events'), index=0): Offsets(lo=4381, hi=4382)})
snuba-subscription-consumer-events_1        | 2021-03-19 21:45:27,595 Worker flush took 0ms
worker_1                                    | 21:45:47 [WARNING] sentry.tasks.release_registry: Release registry URL is not specified, skipping the task.

But nothing is reported by plugin bot.

@BYK
Copy link
Collaborator

BYK commented Mar 22, 2021

It shows that the plugin is installed and working:

worker_1 | 21:45:25 [INFO] sentry.plugins.sentry_telegram_py3: notification.dispatched (event_id='ffeb6e08d9c9486da80c924f0db89e61' group_id=23 plugin='sentry_telegram_py3' rule_id=3 project_id=2)

I'd look into your configuration or the plugin code itself to debug further.

When we add third package like this to requirements.txt file,
Do we need to run install.sh again?

Nope. In the most recent versions of the repo, all you need is a restart which will automatically install any missing plugins upon the first start of the container (and won't install them everytime).

@BYK
Copy link
Collaborator

BYK commented Mar 22, 2021

@omidraha when I said "I'd" I was making a recommendation for you to check them. Unfortunately I don't have the time to investigate individual 3rd-party plugins and their specific integrations.

@BYK
Copy link
Collaborator

BYK commented Oct 15, 2021

Closing this out as it got stale. Right now we do not encourage writing new plugins but investing more into our integration platform. Existing plugins should keep working.

@BYK BYK closed this as completed Oct 15, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants