diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 079b5294472..5a1b3c6e72a 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -1766,7 +1766,9 @@ class ProxyConfig: ) if master_key and master_key.startswith("os.environ/"): master_key = litellm.get_secret(master_key) - litellm_master_key_hash = ph.hash(master_key) + + if master_key is not None and isinstance(master_key, str): + litellm_master_key_hash = ph.hash(master_key) ### CUSTOM API KEY AUTH ### ## pass filepath custom_auth = general_settings.get("custom_auth", None) diff --git a/litellm/tests/test_proxy_custom_auth.py b/litellm/tests/test_proxy_custom_auth.py index 55ab456245a..d4c39e3d5d6 100644 --- a/litellm/tests/test_proxy_custom_auth.py +++ b/litellm/tests/test_proxy_custom_auth.py @@ -55,7 +55,7 @@ def test_custom_auth(client): } # Your bearer token token = os.getenv("PROXY_MASTER_KEY") - + print(f"token: {token}") headers = {"Authorization": f"Bearer {token}"} response = client.post("/chat/completions", json=test_data, headers=headers) pytest.fail("LiteLLM Proxy test failed. This request should have been rejected")