From 1f7c8e86a7361e7853e28dc0022069d40581f867 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Mon, 5 Feb 2024 16:21:54 -0800 Subject: [PATCH] (fix) make sure route is str --- litellm/proxy/proxy_server.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 781c676c8e3..289a36cb2b0 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -652,8 +652,13 @@ async def user_api_key_auth( "/user", ] # check if the current route startswith any of the allowed routes - if any( - route.startswith(allowed_route) for allowed_route in allowed_routes + if ( + route is not None + and isinstance(route, str) + and any( + route.startswith(allowed_route) + for allowed_route in allowed_routes + ) ): # Do something if the current route starts with any of the allowed routes pass