Closed
Description
What happened?
After redeploy, we got redis==3.0.1
instead redis==2.10.6
. So, when you try to work with cache for example, we got the exception:
DataError: Invalid input of type: 'CacheKey'. Convert to a byte, string or number first.
File "django/core/handlers/exception.py", line 35, in inner
response = get_response(request)
File "django/core/handlers/base.py", line 128, in _get_response
response = self.process_exception_by_middleware(e, request)
File "django/core/handlers/base.py", line 126, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "python3.6/contextlib.py", line 52, in inner
return func(*args, **kwds)
File "django/utils/decorators.py", line 134, in _wrapped_view
result = middleware.process_request(request)
File "django/middleware/cache.py", line 133, in process_request
cache_key = get_cache_key(request, self.key_prefix, 'GET', cache=self.cache)
File "django/utils/cache.py", line 360, in get_cache_key
headerlist = cache.get(cache_key)
File "django_redis/cache.py", line 32, in _decorator
return method(self, *args, **kwargs)
File "django_redis/cache.py", line 81, in get
client=client)
File "django_redis/client/default.py", line 202, in get
value = client.get(key)
File "redis/client.py", line 1207, in get
return self.execute_command('GET', name)
File "redis/client.py", line 754, in execute_command
connection.send_command(*args)
File "redis/connection.py", line 619, in send_command
self.send_packed_command(self.pack_command(*args))
File "redis/connection.py", line 659, in pack_command
for arg in imap(self.encoder.encode, args):
File "redis/connection.py", line 124, in encode
"byte, string or number first." % typename)
The problem exactly in the redis==3.0.1
, as we may see there: https://stackoverflow.com/questions/53331405/django-compress-error-invalid-input-of-type-cachekey
It is because of this pkg sets in the requiriments/base.txt
as redis>=2.10.5 # https://github.com/antirez/redis
What should've happened instead?
All should work well
Steps to reproduce
Just rebuild compose.
(Ubuntu 18.04, Docker 17.05.0-ce)
Activity
egregors commentedon Nov 18, 2018
This is all about this issue: jazzband/django-redis#342
browniebroke commentedon Nov 19, 2018
Hi, thanks for the report. I believe it was fixed upstream in
django-redis
. I've just merged #1870 which should solve this.egregors commentedon Nov 20, 2018
@browniebroke Unfortunately, I still get Error, even with
django-redis==4.10.0
andredis==3
Do you still think pinning redis to 2.10.4, <3 is a bad idea? At least as a temporary solution.
browniebroke commentedon Nov 20, 2018
Well, the error is different. Technically, it is now coming from Celery/Kombu, not from django-celery. They did a similar fix: celery/kombu#947 but it's not yet released.
angerrp commentedon Feb 1, 2021
@egregors did u find a proper fix for this? having the same issue