From 9aacb75e84238b650a265a36425cfb902e4dc546 Mon Sep 17 00:00:00 2001 From: Untone Date: Tue, 30 Apr 2024 16:18:50 +0300 Subject: [PATCH] auth-debug --- services/auth.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/services/auth.py b/services/auth.py index dfc41821..e2242410 100644 --- a/services/auth.py +++ b/services/auth.py @@ -15,8 +15,9 @@ async def get_author_by_user(user: str): result = await redis.execute("GET", redis_key) if isinstance(result, str): author = json.loads(result) - - return author + if author: + return author + return async def request_data(gql, headers=None): @@ -99,6 +100,8 @@ def login_required(f): info.context["user_id"] = user_id.strip() info.context["roles"] = user_roles author = await get_author_by_user(user_id) + if not author: + logger.error(f'author profile not found for user {user_id}') info.context["author"] = author return await f(*args, **kwargs)