diff --git a/litellm/integrations/slack_alerting.py b/litellm/integrations/slack_alerting.py index 8ae23c629f..44d0e48871 100644 --- a/litellm/integrations/slack_alerting.py +++ b/litellm/integrations/slack_alerting.py @@ -1263,6 +1263,10 @@ Model Info: if self.alerting is None or "email" not in self.alerting: # do nothing if user does not want email alerts + verbose_proxy_logger.error( + "Error sending email alert - 'email' not in self.alerting %s", + self.alerting, + ) return False from litellm.proxy.proxy_server import premium_user, prisma_client diff --git a/litellm/proxy/common_utils/admin_ui_utils.py b/litellm/proxy/common_utils/admin_ui_utils.py index 3389f723d8..3044ba3afe 100644 --- a/litellm/proxy/common_utils/admin_ui_utils.py +++ b/litellm/proxy/common_utils/admin_ui_utils.py @@ -168,14 +168,14 @@ def missing_keys_form(missing_key_names: str): return missing_keys_html_form.format(missing_keys=missing_key_names) -def setup_admin_ui_on_server_root_path(): +def setup_admin_ui_on_server_root_path(server_root_path: str): """ Helper util to setup Admin UI on Server root path """ from litellm._logging import verbose_proxy_logger - server_root_path = os.getenv("SERVER_ROOT_PATH", "") if server_root_path != "": + print("setting proxy base url to server root path") # noqa if os.getenv("PROXY_BASE_URL") is None: os.environ["PROXY_BASE_URL"] = server_root_path @@ -190,9 +190,7 @@ def setup_admin_ui_on_server_root_path(): build_ui_path = os.path.join(current_dir, "build_ui_custom_path.sh") package_path = os.path.join(current_dir, "package.json") - verbose_proxy_logger.debug( - f"Setting up Admin UI on {server_root_path}/ui ......." - ) # noqa + print(f"Setting up Admin UI on {server_root_path}/ui .......") # noqa try: # Change the current working directory @@ -212,21 +210,17 @@ def setup_admin_ui_on_server_root_path(): ["./build_ui_custom_path.sh", f"{server_root_path}/ui"], check=True ) - verbose_proxy_logger.debug("Admin UI setup completed successfully.") # noqa + print("Admin UI setup completed successfully.") # noqa except subprocess.CalledProcessError as e: - verbose_proxy_logger.debug( - f"An error occurred during the Admin UI setup: {e}" - ) # noqa + print(f"An error occurred during the Admin UI setup: {e}") # noqa except Exception as e: - verbose_proxy_logger.debug(f"An unexpected error occurred: {e}") + print(f"An unexpected error occurred: {e}") # noqa finally: # Always return to the original directory, even if an error occurred os.chdir(original_dir) - verbose_proxy_logger.debug( - f"Returned to original directory: {original_dir}" - ) # noqa + print(f"Returned to original directory: {original_dir}") # noqa pass diff --git a/litellm/proxy/health_endpoints/_health_endpoints.py b/litellm/proxy/health_endpoints/_health_endpoints.py index b1f30e04aa..ce80dc2883 100644 --- a/litellm/proxy/health_endpoints/_health_endpoints.py +++ b/litellm/proxy/health_endpoints/_health_endpoints.py @@ -241,10 +241,8 @@ async def health_services_endpoint( ) # use create task - this can take 10 seconds. don't keep ui users waiting for notification to check their email - asyncio.create_task( - proxy_logging_obj.slack_alerting_instance.send_key_created_or_user_invited_email( - webhook_event=webhook_event - ) + await proxy_logging_obj.slack_alerting_instance.send_key_created_or_user_invited_email( + webhook_event=webhook_event ) return { diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 47c17d49de..59efaae101 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -284,8 +284,9 @@ except Exception as e: pass server_root_path = os.getenv("SERVER_ROOT_PATH", "") +print("server root path: ", server_root_path) # noqa if server_root_path != "": - setup_admin_ui_on_server_root_path() + setup_admin_ui_on_server_root_path(server_root_path) _license_check = LicenseCheck() premium_user: bool = _license_check.is_premium() ui_link = f"{server_root_path}/ui/" @@ -2103,7 +2104,6 @@ class ProxyConfig: for alert in _general_settings["alerting"]: if alert not in general_settings["alerting"]: general_settings["alerting"].append(alert) - proxy_logging_obj.alerting = general_settings["alerting"] proxy_logging_obj.slack_alerting_instance.alerting = general_settings[ "alerting" @@ -2115,6 +2115,12 @@ class ProxyConfig: proxy_logging_obj.slack_alerting_instance.alerting = general_settings[ "alerting" ] + elif isinstance(general_settings, dict): + general_settings["alerting"] = _general_settings["alerting"] + proxy_logging_obj.alerting = general_settings["alerting"] + proxy_logging_obj.slack_alerting_instance.alerting = general_settings[ + "alerting" + ] if "alert_types" in _general_settings: general_settings["alert_types"] = _general_settings["alert_types"]