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

UnicodeDecodeError with certain Redis keys #3117

Closed
jclgoodwin opened this issue Jun 1, 2024 · 1 comment · Fixed by #3110
Closed

UnicodeDecodeError with certain Redis keys #3117

jclgoodwin opened this issue Jun 1, 2024 · 1 comment · Fixed by #3110
Assignees
Labels
Integration: Celery Type: Bug Something isn't working

Comments

@jclgoodwin
Copy link

How do you use Sentry?

Sentry Saas (sentry.io)

Version

2.3.1

Steps to Reproduce

I'm using a UUID's .bytes as a key in Redis, instead of a human-readable string:

import uuid

redis_client.lrange(uuid.uuid4().bytes, 0, -1)
# or
redis_client.lrange(b'\x14\x00\xa3\xc0\xf5ZB\xe9\x83+\x1e\xe7\xaa\xb8\xb7A', 0, -1)

Expected Result

With Sentry SDK version 2.3.0, it works fine.

Actual Result

With version 2.3.1, I get a UnicodeDecodeError:

   File "/opt/poetry/lib/python3.12/site-packages/redis/commands/core.py", line 2755, in lrange
     return self.execute_command("LRANGE", name, start, end)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/opt/poetry/lib/python3.12/site-packages/sentry_sdk/integrations/redis/_sync_common.py", line 72, in sentry_patched_execute_command
     cache_properties = _compile_cache_span_properties(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/opt/poetry/lib/python3.12/site-packages/sentry_sdk/integrations/redis/modules/caches.py", line 32, in _compile_cache_span_properties
     key = _get_safe_key(redis_command, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/opt/poetry/lib/python3.12/site-packages/sentry_sdk/integrations/redis/utils.py", line 60, in _get_safe_key
     key = args[0].decode() if isinstance(args[0], bytes) else args[0]
           ^^^^^^^^^^^^^^^^

This appears to be have been introduced in #3101

@sentrivana
Copy link
Contributor

Thank @jclgoodwin, we'll fix this asap. In the meantime please stay on 2.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Integration: Celery Type: Bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants