From c110f5a2aa360fb72d262b7157c2de4301739ac8 Mon Sep 17 00:00:00 2001 From: Genmin Date: Fri, 1 May 2026 07:31:17 -0700 Subject: [PATCH] fix: reject unconfigured s3 health checks --- litellm/proxy/health_endpoints/_health_endpoints.py | 7 +++++++ .../test_health_services_callbacks.py | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/litellm/proxy/health_endpoints/_health_endpoints.py b/litellm/proxy/health_endpoints/_health_endpoints.py index 9760e7e4a52..ea050d8313d 100644 --- a/litellm/proxy/health_endpoints/_health_endpoints.py +++ b/litellm/proxy/health_endpoints/_health_endpoints.py @@ -240,6 +240,13 @@ async def health_services_endpoint( # noqa: PLR0915 "status": "success", "message": "Mock LLM request made - check {}.".format(service), } + elif service == "s3": + raise HTTPException( + status_code=422, + detail={ + "error": '"s3" not in proxy config: litellm_settings.success_callback. Unable to test this.' + }, + ) elif service == "datadog": from litellm.integrations.datadog.datadog import DataDogLogger diff --git a/tests/test_litellm/proxy/health_endpoints/test_health_services_callbacks.py b/tests/test_litellm/proxy/health_endpoints/test_health_services_callbacks.py index c82b02c5d65..a119d2cd5d8 100644 --- a/tests/test_litellm/proxy/health_endpoints/test_health_services_callbacks.py +++ b/tests/test_litellm/proxy/health_endpoints/test_health_services_callbacks.py @@ -3,6 +3,7 @@ from unittest.mock import AsyncMock, patch import pytest from litellm.proxy.health_endpoints._health_endpoints import health_services_endpoint +from litellm.proxy._types import ProxyException @pytest.mark.asyncio @@ -15,3 +16,13 @@ async def test_health_services_endpoint_accepts_s3_callback(): assert result["status"] == "success" assert "s3" in result["message"] + + +@pytest.mark.asyncio +async def test_health_services_endpoint_rejects_unconfigured_s3_callback(): + with patch("litellm.success_callback", []): + with pytest.raises(ProxyException) as exc_info: + await health_services_endpoint(service="s3") + + assert exc_info.value.code == "422" + assert "litellm_settings.success_callback" in str(exc_info.value.message)