From 94836a3ce7f6f1b7701ef99786c14129b0de70d7 Mon Sep 17 00:00:00 2001 From: risson <18313093+rissson@users.noreply.github.com> Date: Thu, 27 Jul 2023 11:29:20 +0200 Subject: [PATCH] api: log errors if app URLs import fail (#6397) * api: log errors if app URLs import fail Signed-off-by: Marc 'risson' Schmitt * bump level to warning Signed-off-by: Jens Langhammer --------- Signed-off-by: Marc 'risson' Schmitt Signed-off-by: Jens Langhammer Co-authored-by: Jens Langhammer --- authentik/api/v3/urls.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/authentik/api/v3/urls.py b/authentik/api/v3/urls.py index f6b2f45f8..a3e92c7c9 100644 --- a/authentik/api/v3/urls.py +++ b/authentik/api/v3/urls.py @@ -21,9 +21,14 @@ _other_urls = [] for _authentik_app in get_apps(): try: api_urls = import_module(f"{_authentik_app.name}.urls") - except (ModuleNotFoundError, ImportError): + except (ModuleNotFoundError, ImportError) as exc: + LOGGER.warning("Could not import app's URLs", app_name=_authentik_app.name, exception=exc) continue if not hasattr(api_urls, "api_urlpatterns"): + LOGGER.debug( + "App does not define API URLs", + app_name=_authentik_app.name, + ) continue urls: list = getattr(api_urls, "api_urlpatterns") for url in urls: