Skip to content

[BUG CLIENT]: timeout is lose in GoogleCloudBeforeRequestHook and use default value #253

@gdespres-solocal

Description

@gdespres-solocal

Python -VV

Python 3.11.6 (main, Nov  2 2023, 04:39:43) [Clang 14.0.3 (clang-1403.0.22.14.1)]

Pip Freeze

annotated-types==0.7.0
anyio==4.9.0
azure-common==1.1.28
azure-core==1.35.0
azure-identity==1.23.0
azure-mgmt-appcontainers==3.2.0
azure-mgmt-compute==34.1.0
azure-mgmt-containerinstance==10.1.0
azure-mgmt-containerservice==32.1.0
azure-mgmt-core==1.6.0
azure-mgmt-network==27.0.0
azure-mgmt-rdbms==10.1.0
azure-mgmt-redis==14.5.0
azure-mgmt-resource==23.4.0
azure-mgmt-sql==3.0.1
azure-mgmt-subscription==3.1.1
azure-mgmt-web==7.3.1
cachetools==5.5.2
certifi==2025.6.15
cffi==1.17.1
charset-normalizer==3.4.2
cryptography==45.0.5
defusedxml==0.7.1
eval_type_backport==0.2.2
glpi-api==0.5.0
google-api-core==2.25.1
google-api-python-client==2.133.0
google-auth==2.40.3
google-auth-httplib2==0.2.0
google-cloud-access-context-manager==0.2.2
google-cloud-asset==3.30.1
google-cloud-bigquery==3.34.0
google-cloud-compute==1.31.0
google-cloud-core==2.4.3
google-cloud-org-policy==1.14.0
google-cloud-os-config==1.20.2
google-crc32c==1.7.1
google-genai==1.27.0
google-resumable-media==2.7.2
googleapis-common-protos==1.70.0
grpc-google-iam-v1==0.14.2
grpcio==1.73.1
grpcio-status==1.73.1
h11==0.16.0
httpcore==1.0.9
httplib2==0.22.0
httpx==0.28.1
idna==3.10
isodate==0.7.2
jira==3.8.0
mistralai==1.9.3
msal==1.32.3
msal-extensions==1.3.1
msrest==0.7.1
mysql-connector-python==8.4.0
oauth2client==4.1.3
oauthlib==3.3.1
packaging==25.0
pillow==11.3.0
proto-plus==1.26.1
protobuf==6.31.1
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
pydantic==2.11.7
pydantic_core==2.33.2
PyJWT==2.10.1
pymsteams==0.2.5
pyparsing==3.2.3
python-dateutil==2.9.0.post0
requests==2.32.4
requests-oauthlib==2.0.0
requests-toolbelt==1.0.0
rsa==4.9.1
six==1.17.0
sniffio==1.3.1
tenacity==8.5.0
typing-inspection==0.4.1
typing_extensions==4.14.1
uritemplate==4.2.0
urllib3==2.5.0
websockets==15.0.1

Reproduction Steps

Call with timeout 30 seconds

mistral = MistralGoogleCloud(project_id=gcp_project_id, region=gcp_region)
mistral.chat.complete(timeout_ms=30000, messages=[...])

Client throw a timeout exception after 5 seconds (default value)

It's due before_request method of class GoogleCloudBeforeRequestHook doesn't pass 'extensions' argument to the next request.

Expected Behavior

Client use the timeout define with 'timeout_ms' parameter

Additional Context

No response

Suggested Solutions

Client have to pass 'extensions' parameter to next_request.

next_request = httpx.Request(
method=request.method,
url=request.url.copy_with(path=url),
headers=headers,
content=new_content,
stream=None,
extensions=request.extensions,
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions