diff --git a/src/config/redis.py b/src/config/redis.py index 2519e57..24eb4ca 100644 --- a/src/config/redis.py +++ b/src/config/redis.py @@ -52,11 +52,18 @@ def get_redis_config(): Returns: dict: Redis configuration parameters """ + # Treat empty string as None — Redis server without a password rejects + # AUTH when a non-None password is sent (redis-py sends AUTH even for ""), + # raising: "AUTH called without any password configured". + redis_password = os.getenv("REDIS_PASSWORD", None) + if redis_password is not None and redis_password.strip() == "": + redis_password = None + return { "host": os.getenv("REDIS_HOST", "localhost"), "port": int(os.getenv("REDIS_PORT", 6379)), "db": int(os.getenv("REDIS_DB", 0)), - "password": os.getenv("REDIS_PASSWORD", None), + "password": redis_password, "ssl": os.getenv("REDIS_SSL", "false").lower() == "true", "key_prefix": os.getenv("REDIS_KEY_PREFIX", "a2a:"), "default_ttl": int(os.getenv("REDIS_TTL", 3600)), diff --git a/src/services/adk/mcp_cache.py b/src/services/adk/mcp_cache.py index 24e0aec..e97391c 100644 --- a/src/services/adk/mcp_cache.py +++ b/src/services/adk/mcp_cache.py @@ -69,11 +69,18 @@ def __init__(self): f"Redis configuration: host={redis_config['host']}, port={redis_config['port']}, db={redis_config['db']}" ) + # Defensive: ensure empty string password becomes None to avoid + # "AUTH called without any password configured" error on Redis servers + # that run without AUTH (common in community Docker setups). + redis_password = redis_config.get("password") + if redis_password is not None and str(redis_password).strip() == "": + redis_password = None + self.redis = redis.Redis( host=redis_config["host"], port=redis_config["port"], db=redis_config["db"], - password=redis_config["password"], + password=redis_password, ssl=redis_config["ssl"], decode_responses=False, # We need bytes for pickle )