Sanic-JWT-Extended icon indicating copy to clipboard operation
Sanic-JWT-Extended copied to clipboard

redis blacklist is throwing an error

Open garcia-0E opened this issue 4 years ago • 3 comments

Hello guys.

i'm using the blacklist_enable config property as true and blacklist class is RedisBlacklist, running along sanic with default config:

    manager.config.use_blacklist = True
     manager.config.blacklist_class = RedisBlacklist
     manager.config.blacklist_init_kwargs = {
        "connection_info": {
            "address": "redis://:@127.0.0.1:6379",
            "minsize" : 5,
            "maxsize" : 10
        }
    }

However when i'm using token.revoke() method in any endpoint it crashes and throws : tuple or str expected. Is anyone having the same issue or knows how to solve this?

garcia-0E avatar Jul 10 '20 15:07 garcia-0E

Could you show me a detailed traceback?

rscarrera27 avatar Jul 11 '20 06:07 rscarrera27

I'm not able to traceback the exception because it crashes even before entering the function. It seems as internal bug when managing blacklist with redis and token.revoke() is identified within a function

garcia-0E avatar Jul 13 '20 14:07 garcia-0E

Could you show me a detailed traceback?

with JWT.initialize(app) as manager:
    manager.config.secret_key = "secret"
    manager.config.jwt_header_key = "x-api-key"
    manager.config.use_blacklist = True
    manager.config.blacklist_class = RedisBlacklist
    manager.config.blacklist_init_kwargs = {
        "connection_info": {
            "address": "redis://:@127.0.0.1:6379",
            "minsize": 5,
            "maxsize": 10,
        }
    }

Traceback (most recent call last): File "C:\Program Files\Python38\lib\site-packages\sanic\app.py", line 724, in handle_request response = await response File "C:\Users\b\Documents\github\shop_sanic_mongodb\sanic_jwt_extended\decorators.py", line 165, in wrapper if JWT.config.use_blacklist and await JWT.blacklist.is_blacklisted( File "C:\Users\b\Documents\github\shop_sanic_mongodb\sanic_jwt_extended\blacklist.py", line 48, in is_blacklisted await RedisConnection.initialize(self.connection_info) File "C:\Users\b\Documents\github\shop_sanic_mongodb\sanic_jwt_extended\redis.py", line 22, in initialize await cls._get_redis_connection() File "C:\Users\b\Documents\github\shop_sanic_mongodb\sanic_jwt_extended\redis.py", line 16, in get_redis_connection cls.redis = await aioredis.create_redis_pool(cls.connection_info) File "C:\Program Files\Python38\lib\site-packages\aioredis\commands_init.py", line 188, in create_redis_pool pool = await create_pool(address, db=db, File "C:\Program Files\Python38\lib\site-packages\aioredis\pool.py", line 58, in create_pool await pool._fill_free(override_min=False) File "C:\Program Files\Python38\lib\site-packages\aioredis\pool.py", line 383, in _fill_free conn = await self._create_new_connection(self._address) File "C:\Program Files\Python38\lib\site-packages\aioredis\connection.py", line 81, in create_connection assert isinstance(address, (tuple, list, str)), "tuple or str expected" AssertionError: tuple or str expected

no5ix avatar Jun 19 '21 17:06 no5ix