Skip to content

Commit d96fb3f

Browse files
shellmayrclaude
andcommitted
fix(google_genai): Add minimum version check in setup_once
The GoogleGenAI integration is auto-enabled but was not checking the minimum version (1.29.0) before attempting to patch methods. This could cause AttributeError crashes during Sentry initialization if a user has an older version of google-genai installed. Add _check_minimum_version call in setup_once() to ensure graceful handling of incompatible versions, matching the pattern used by other auto-enabled integrations like Anthropic. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 84740ff commit d96fb3f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

sentry_sdk/integrations/google_genai/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ def __init__(self: "GoogleGenAIIntegration", include_prompts: bool = True) -> No
4545

4646
@staticmethod
4747
def setup_once() -> None:
48+
from sentry_sdk.integrations import _check_minimum_version
49+
from sentry_sdk.utils import package_version
50+
51+
version = package_version("google-genai")
52+
_check_minimum_version(GoogleGenAIIntegration, version, package="google-genai")
53+
4854
# Patch sync methods
4955
Models.generate_content = _wrap_generate_content(Models.generate_content)
5056
Models.generate_content_stream = _wrap_generate_content_stream(

0 commit comments

Comments
 (0)