From db3cdb9885fe6fc594e035c0aae709f3d5c6f1c8 Mon Sep 17 00:00:00 2001 From: Axel Suarez Date: Mon, 28 Jul 2025 15:42:03 -0700 Subject: [PATCH] Handler config fix --- .../agents/hosting/core/app/agent_application.py | 2 +- .../agents/hosting/core/app/oauth/authorization.py | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/libraries/microsoft-agents-hosting-core/microsoft/agents/hosting/core/app/agent_application.py b/libraries/microsoft-agents-hosting-core/microsoft/agents/hosting/core/app/agent_application.py index 99cf6b10..da0e90ce 100644 --- a/libraries/microsoft-agents-hosting-core/microsoft/agents/hosting/core/app/agent_application.py +++ b/libraries/microsoft-agents-hosting-core/microsoft/agents/hosting/core/app/agent_application.py @@ -799,7 +799,7 @@ async def _on_error(self, context: TurnContext, err: ApplicationError) -> None: ) return await self._error(context, err) - ogger.error( + logger.error( f"An error occurred in the AgentApplication: {err}", exc_info=True, ) diff --git a/libraries/microsoft-agents-hosting-core/microsoft/agents/hosting/core/app/oauth/authorization.py b/libraries/microsoft-agents-hosting-core/microsoft/agents/hosting/core/app/oauth/authorization.py index bd90ba84..ca420393 100644 --- a/libraries/microsoft-agents-hosting-core/microsoft/agents/hosting/core/app/oauth/authorization.py +++ b/libraries/microsoft-agents-hosting-core/microsoft/agents/hosting/core/app/oauth/authorization.py @@ -124,19 +124,16 @@ def __init__( else auth_configuration.get("AUTOSIGNIN", False) ) - if not auth_handlers: - handlers_congif: Dict[str, Dict] = auth_configuration.get("HANDLERS") - if not handlers_congif: - logger.error("No auth handlers provided in configuration") - raise ValueError("The authorization does not have any auth handlers") + handlers_config: Dict[str, Dict] = auth_configuration.get("HANDLERS") + if not auth_handlers and handlers_config: auth_handlers = { handler_name: AuthHandler( name=handler_name, **config.get("SETTINGS", {}) ) - for handler_name, config in handlers_congif.items() + for handler_name, config in handlers_config.items() } - self._auth_handlers = auth_handlers + self._auth_handlers = auth_handlers or {} self._sign_in_handler: Optional[ Callable[[TurnContext, TurnState, Optional[str]], Awaitable[None]] ] = None