Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
fa49fd4
1
Parent(s):
9acce5b
fix: explicitly disable StarletteIntegration via disabled_integrations
Browse filesSentry auto-enables StarletteIntegration by default even when not in
the integrations list. Use disabled_integrations parameter to explicitly
prevent it from loading and patching the middleware stack.
backend/monitoring/sentry.py
CHANGED
|
@@ -24,14 +24,14 @@ from contextlib import suppress
|
|
| 24 |
try:
|
| 25 |
import sentry_sdk
|
| 26 |
from sentry_sdk.integrations.fastapi import FastApiIntegration
|
|
|
|
| 27 |
from sentry_sdk.integrations.logging import LoggingIntegration
|
| 28 |
from sentry_sdk.integrations.asyncio import AsyncioIntegration
|
| 29 |
-
# NOTE: StarletteIntegration intentionally not imported - causes ASGI conflicts
|
| 30 |
-
# with Gradio's internal BaseHTTPMiddleware
|
| 31 |
SENTRY_AVAILABLE = True
|
| 32 |
except ImportError:
|
| 33 |
SENTRY_AVAILABLE = False
|
| 34 |
sentry_sdk = None
|
|
|
|
| 35 |
|
| 36 |
logger = logging.getLogger(__name__)
|
| 37 |
|
|
@@ -335,6 +335,10 @@ def initialise_sentry() -> bool:
|
|
| 335 |
# Integrations
|
| 336 |
integrations=integrations,
|
| 337 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 338 |
# Additional options
|
| 339 |
debug=os.getenv("SENTRY_DEBUG", "false").lower() == "true",
|
| 340 |
)
|
|
|
|
| 24 |
try:
|
| 25 |
import sentry_sdk
|
| 26 |
from sentry_sdk.integrations.fastapi import FastApiIntegration
|
| 27 |
+
from sentry_sdk.integrations.starlette import StarletteIntegration
|
| 28 |
from sentry_sdk.integrations.logging import LoggingIntegration
|
| 29 |
from sentry_sdk.integrations.asyncio import AsyncioIntegration
|
|
|
|
|
|
|
| 30 |
SENTRY_AVAILABLE = True
|
| 31 |
except ImportError:
|
| 32 |
SENTRY_AVAILABLE = False
|
| 33 |
sentry_sdk = None
|
| 34 |
+
StarletteIntegration = None
|
| 35 |
|
| 36 |
logger = logging.getLogger(__name__)
|
| 37 |
|
|
|
|
| 335 |
# Integrations
|
| 336 |
integrations=integrations,
|
| 337 |
|
| 338 |
+
# Explicitly disable StarletteIntegration - it patches middleware stack
|
| 339 |
+
# which conflicts with Gradio's internal BaseHTTPMiddleware
|
| 340 |
+
disabled_integrations=[StarletteIntegration],
|
| 341 |
+
|
| 342 |
# Additional options
|
| 343 |
debug=os.getenv("SENTRY_DEBUG", "false").lower() == "true",
|
| 344 |
)
|