diff --git a/authentik/tenants/utils.py b/authentik/tenants/utils.py index cd3edc9c2..a59fd49c2 100644 --- a/authentik/tenants/utils.py +++ b/authentik/tenants/utils.py @@ -29,7 +29,10 @@ def get_tenant_for_request(request: HttpRequest) -> Tenant: def context_processor(request: HttpRequest) -> dict[str, Any]: """Context Processor that injects tenant object into every template""" tenant = getattr(request, "tenant", DEFAULT_TENANT) - trace = Hub.current.scope.span.to_traceparent() + trace = "" + span = Hub.current.scope.span + if span: + trace = span.to_traceparent() return { "tenant": tenant, "footer_links": CONFIG.y("footer_links"),