diff --git a/sentry_sdk/integrations/asgi.py b/sentry_sdk/integrations/asgi.py index f34f10dc85..c84e5ba454 100644 --- a/sentry_sdk/integrations/asgi.py +++ b/sentry_sdk/integrations/asgi.py @@ -109,7 +109,7 @@ def __init__( ) asgi_middleware_while_using_starlette_or_fastapi = ( - "starlette" in _get_installed_modules() and mechanism_type == "asgi" + mechanism_type == "asgi" and "starlette" in _get_installed_modules() ) if asgi_middleware_while_using_starlette_or_fastapi: logger.warning(