From 2d8c326030948897f0d38633ad724d101fb9005e Mon Sep 17 00:00:00 2001 From: Daniel Szoke Date: Fri, 3 May 2024 17:55:22 +0200 Subject: [PATCH] fix(quart): Fix Quart integration The Quart integration was completely broken prior to this commit, as it caused every request to fail with a 500 error. The reason was that we were using the non-async `ensure_integration_enabled` decorator on the async `sentry_patched_asgi_app` function. This commit fixes the issue by removing the use of that decorator, instead replacing it with a manual check for the integration being enabled. --- sentry_sdk/integrations/quart.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/integrations/quart.py b/sentry_sdk/integrations/quart.py index 7c2f4ade70..3fc34221d0 100644 --- a/sentry_sdk/integrations/quart.py +++ b/sentry_sdk/integrations/quart.py @@ -87,9 +87,11 @@ def patch_asgi_app(): # type: () -> None old_app = Quart.__call__ - @ensure_integration_enabled(QuartIntegration, old_app) async def sentry_patched_asgi_app(self, scope, receive, send): # type: (Any, Any, Any, Any) -> Any + if sentry_sdk.get_client().get_integration(QuartIntegration) is None: + return await old_app(self, scope, receive, send) + middleware = SentryAsgiMiddleware(lambda *a, **kw: old_app(self, *a, **kw)) middleware.__call__ = middleware._run_asgi3 return await middleware(scope, receive, send)