sentry-python
sentry-python copied to clipboard
`sentry_sdk.init()` >= 1.5.9 breaks if theres a folder named redis
How do you use Sentry?
Sentry Saas (sentry.io)
Version
1.5.9
Steps to Reproduce
I have found that my app doesn't run because Sentry doesn't like there being a folder called redis
. Same in 1.5.10 . This error doesn't happen using 1.5.8
This test works fine in an empty directory:
$ pip install sentry_sdk==1.5.9 && python -c "import sentry_sdk;sentry_sdk.init()"
Expected Result
nothing
Actual Result
Running the same command after mkdir redis
, I get:
Requirement already satisfied: sentry_sdk==1.5.9 in /home/cioos/ceda/virtualenv/lib/python3.9/site-packages (1.5.9)
Requirement already satisfied: urllib3>=1.10.0 in /home/cioos/ceda/virtualenv/lib/python3.9/site-packages (from sentry_sdk==1.5.9) (1.26.8)
Requirement already satisfied: certifi in /home/cioos/ceda/virtualenv/lib/python3.9/site-packages (from sentry_sdk==1.5.9) (2021.10.8)
WARNING: You are using pip version 21.2.3; however, version 22.0.4 is available.
You should consider upgrading via the '/home/cioos/ceda/virtualenv/bin/python -m pip install --upgrade pip' command.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/cioos/ceda/virtualenv/lib/python3.9/site-packages/sentry_sdk/hub.py", line 105, in _init
client = Client(*args, **kwargs) # type: ignore
File "/home/cioos/ceda/virtualenv/lib/python3.9/site-packages/sentry_sdk/client.py", line 86, in __init__
self._init_impl()
File "/home/cioos/ceda/virtualenv/lib/python3.9/site-packages/sentry_sdk/client.py", line 120, in _init_impl
self.integrations = setup_integrations(
File "/home/cioos/ceda/virtualenv/lib/python3.9/site-packages/sentry_sdk/integrations/__init__.py", line 122, in setup_integrations
type(integration).setup_once()
File "/home/cioos/ceda/virtualenv/lib/python3.9/site-packages/sentry_sdk/integrations/redis.py", line 48, in setup_once
patch_redis_client(redis.StrictRedis)
AttributeError: module 'redis' has no attribute 'StrictRedis'
Hey @n-a-t-e ! Thanks for the bug report. With release 1.5.9 we released auto enabling of the redis integration: https://github.com/getsentry/sentry-python/pull/737/files
It seems this broke your code. So the quick fix for you would be to downgrade to 1.5.8.
As this is a regression we put it on high priority.
Any news on this one ?
Thanks.
As a workaround you can include this in your redis module:
class RedisTemp:
def execute_command(self):
pass
StrictRedis = RedisTemp()