Skip to content

Commit

Permalink
fix(quart): Fix Quart integration (#3043)
Browse files Browse the repository at this point in the history
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.

Fixes GH-3040
  • Loading branch information
szokeasaurusrex committed May 3, 2024
1 parent aaa8f04 commit c368a2f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sentry_sdk/integrations/quart.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c368a2f

Please sign in to comment.