Browse Source

fix(replays): decode replay as bytes if str from cache (#41231)

Trying to fix SENTRY-WDT, we first did #41111, which ensures that we
always receive the payload as bytes. however, depending on cache
configuration the cache can also return a string, which causes this
error to still happen. Given that, when we retrieve our segment part
from cache, we'll encode it if it's a string.

We'll likely want to compress this value for the cache which will always
render it un-encodable, so we can remove this check if we do that.
Josh Ferge 2 years ago
parent
commit
fe7a3312dc
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/sentry/replays/cache.py

+ 1 - 1
src/sentry/replays/cache.py

@@ -45,7 +45,7 @@ class RecordingSegmentParts:
         """Iterate over each recording segment part."""
         part = RecordingSegmentCache(self.prefix)
         for i in range(self.num_parts):
-            yield part[i]
+            yield part[i].encode("utf-8") if type(part[i]) is str else part[i]
 
     def drop(self):
         """Delete all the parts associated with the recording segment."""