From dff120bac650e1efbaca2a4282f95931e05a5426 Mon Sep 17 00:00:00 2001 From: nndn Date: Thu, 20 Nov 2025 06:54:12 +0530 Subject: [PATCH] fix: remove sentry hard dependency --- app/main.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/app/main.py b/app/main.py index a6caafd3..906b848b 100644 --- a/app/main.py +++ b/app/main.py @@ -59,11 +59,26 @@ def __init__(self): def setup_sentry(self): if os.getenv("ENV") == "production": - sentry_sdk.init( - dsn=os.getenv("SENTRY_DSN"), - traces_sample_rate=0.25, - profiles_sample_rate=1.0, - ) + try: + # Explicitly configure integrations to avoid auto-enabling Strawberry + # which causes crashes when Strawberry is not installed + from sentry_sdk.integrations.fastapi import FastApiIntegration + from sentry_sdk.integrations.logging import LoggingIntegration + from sentry_sdk.integrations.stdlib import StdlibIntegration + + sentry_sdk.init( + dsn=os.getenv("SENTRY_DSN"), + traces_sample_rate=0.25, + profiles_sample_rate=1.0, + default_integrations=False, + integrations=[ + FastApiIntegration(), + LoggingIntegration(), + StdlibIntegration(), + ], + ) + except Exception as e: + logging.warning(f"Sentry initialization failed (non-fatal): {e}") def setup_phoenix_tracing(self): try: