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

sentry-sdk==19.0 init throws RuntimeError on python3.6 #858

Closed
sgjurano opened this issue Oct 13, 2020 · 12 comments · Fixed by #860
Closed

sentry-sdk==19.0 init throws RuntimeError on python3.6 #858

sgjurano opened this issue Oct 13, 2020 · 12 comments · Fixed by #860
Assignees

Comments

@sgjurano
Copy link

import sentry_sdk

...

sentry_sdk.init(
        dsn,
        environment=env,
        debug=True,
)
/usr/local/lib/python3.6/site-packages/sentry_sdk/hub.py:106: in _init
    client = Client(*args, **kwargs)  # type: ignore
/usr/local/lib/python3.6/site-packages/sentry_sdk/client.py:86: in __init__
    self._init_impl()
/usr/local/lib/python3.6/site-packages/sentry_sdk/client.py:132: in _init_impl
    "auto_enabling_integrations"
/usr/local/lib/python3.6/site-packages/sentry_sdk/integrations/__init__.py:119: in setup_integrations
    type(integration).setup_once()
/usr/local/lib/python3.6/site-packages/sentry_sdk/integrations/flask.py:75: in setup_once
    request_started.connect(_request_started)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <flask.signals._FakeSignal object at 0x7fc514b484e0>, args = (<function _request_started at 0x7fc515228840>,), kwargs = {}

    def _fail(self, *args, **kwargs):
        raise RuntimeError(
>           "Signalling support is unavailable because the blinker"
            " library is not installed."
        )
E       RuntimeError: Signalling support is unavailable because the blinker library is not installed.

/usr/local/lib/python3.6/site-packages/flask/signals.py:39: RuntimeError

It can be fixed if blinker is manually installed, please add blinker to sentry-sdk dependencies.

@kalzoo
Copy link

kalzoo commented Oct 13, 2020

Please don't add blinker to sentry-sdk dependencies, since not everyone is using a flask app.

The question from my POV is why Sentry assumes that if Flask is present, it should load its integration? And second, since flask itself gracefully falls back if blinker is absent, shouldn't sentry do the same?

Starting with Flask 0.6, there is integrated support for signalling in Flask. This support is provided by the excellent blinker library and will gracefully fall back if it is not available.

@untitaker
Copy link
Member

The docs tell you to install with the Flask extra which will pull blinker in https://docs.sentry.io/platforms/python/guides/flask/

Blinker is required for basic functionality, there is no possible fallback other than to stop working entirely.

@cancan101
Copy link

cancan101 commented Oct 13, 2020

I am also having this error with the upgrade. While I have Flask installed I am not using the flask plugin with sentry (I use sentry just with starlette).

@untitaker
Copy link
Member

Ah I see, 19.0. @HazAT @lobsterkatie can you deal with this? We should attempt to import blinker and raise DidNotEnable if it is not importable, inside of the flask integration.

@wcsten
Copy link

wcsten commented Oct 13, 2020

Using auto_enabling_integrations=False in sentry_sdk.init works for me.
Example:

sentry_sdk.init(settings.SENTRY_DSN, auto_enabling_integrations=False)

@epsyl
Copy link

epsyl commented Oct 14, 2020

Please, set auto_enabling_integrations to False by default

@joaoamaro70
Copy link

I'm getting this error with Django integration.

import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

sentry_sdk.init(
    integrations=[DjangoIntegration()],
    traces_sample_rate=1.0,
    send_default_pii=True
)
File "/opt/project/aton-backend/settings/local.py", line 5, in <module>
  sentry_sdk.init(
File "/usr/local/lib/python3.8/site-packages/sentry_sdk/hub.py", line 106, in _init
  client = Client(*args, **kwargs)  # type: ignore
File "/usr/local/lib/python3.8/site-packages/sentry_sdk/client.py", line 86, in __init__
  self._init_impl()
File "/usr/local/lib/python3.8/site-packages/sentry_sdk/client.py", line 128, in _init_impl
  self.integrations = setup_integrations(
File "/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/__init__.py", line 119, in setup_integrations
  type(integration).setup_once()
File "/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/flask.py", line 75, in setup_once
  request_started.connect(_request_started)
File "/usr/local/lib/python3.8/site-packages/flask/signals.py", line 38, in _fail
  raise RuntimeError(
RuntimeError: Signalling support is unavailable because the blinker library is not installed.

Setting auto_enabling_integrations to False solved the issue.

@HazAT
Copy link
Member

HazAT commented Oct 15, 2020

Fix is otw

rriski pushed a commit to Prodeko/vaalikoppi that referenced this issue Oct 17, 2020
@untitaker
Copy link
Member

Hey, sorry for the delay. 0.19.1 is out which fixes this issue.

@kalzoo
Copy link

kalzoo commented Oct 20, 2020

Thanks @untitaker for the fix!

@ghost
Copy link

ghost commented Nov 18, 2020

pip install --upgrade 'sentry-sdk[flask]' worked for me.

jpopelka added a commit to jpopelka/packit-service that referenced this issue Dec 16, 2020
This reverts commit f064ca1.

Problem has been fixed since 0.19.1
getsentry/sentry-python#858 (comment)
jpopelka added a commit to jpopelka/packit-service that referenced this issue Dec 17, 2020
This reverts commit f064ca1.

Problem has been fixed since 0.19.1
getsentry/sentry-python#858 (comment)
jpopelka added a commit to jpopelka/packit-service that referenced this issue Dec 18, 2020
This reverts commit f064ca1.

Problem has been fixed since 0.19.1
getsentry/sentry-python#858 (comment)
jpopelka added a commit to jpopelka/packit-service that referenced this issue Jan 4, 2021
This reverts commit f064ca1.

Problem has been fixed since 0.19.1
getsentry/sentry-python#858 (comment)
jpopelka added a commit to jpopelka/packit-service that referenced this issue Jan 4, 2021
This reverts commit f064ca1.

Problem has been fixed since 0.19.1
getsentry/sentry-python#858 (comment)
@Garrett-R
Copy link

pip install --upgrade 'sentry-sdk[flask]' worked for me.

What's the equivalent of this for a pyproject.toml file? Or must I add 2 packages there: sentry-sdk and blinker?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants