Expired authentication credentials are reported as HTTP 503 (Service Unavailable) errors

Đang mở
#18,419 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
65/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
google-cloud, python
Lĩnh vực
api, authentication

Hướng nghiên cứu

Reproduce the failure from stormware/google/secrets.py at line 71 using expired credentials, then trace the generated Secret Manager client through google/api_core/gapic_v1/method.py and google/api_core/retry/retry_unary.py. Done means expired-credential failures surface immediately as an authentication error rather than being retried as HTTP 503 until the 60-second timeout.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

triage me type: bug
Determine this is the right repository
  • I determined this is the correct repository in which to report this bug.
Summary of the issue

Context
Whenever we try to use the SDK clients with expired authentication credentials our programs halt for 60 seconds. This is because such requests get a 503 HTTP response back (which is not the correct response), so the library keeps retrying until the default timeout (which is 60 seconds).

Expected Behavior:
We expect SDK clients to fail immediately when credentials are expired.

Actual Behavior:
SDK clients do not fail immediately when credentials are expired.

API client name and version

google-cloud-secret-manager==2.30.0

Reproduction steps: code

See https://github.com/logikal-io/stormware/blob/main/stormware/google/secrets.py#L71.

Reproduction steps: supporting files

No response

Reproduction steps: actual results

The errors seen are as follows:

  File ".../lib/python3.12/site-packages/stormware/google/secrets.py", line 71, in __getitem__
    response = self.client.access_secret_version(name=name)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../lib/python3.12/site-packages/google/cloud/secretmanager_v1/services/secret_manager_service/client.py", line 1875, in access_secret_version
    response = rpc(
               ^^^^
  File ".../lib/python3.12/site-packages/google/api_core/gapic_v1/method.py", line 373, in __call__
    result = wrapped_func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../lib/python3.12/site-packages/google/api_core/retry/retry_unary.py", line 295, in retry_wrapped_func
    return retry_target(
           ^^^^^^^^^^^^^
  File ".../lib/python3.12/site-packages/google/api_core/retry/retry_unary.py", line 157, in retry_target
    next_sleep = _retry_error_helper(
                 ^^^^^^^^^^^^^^^^^^^^
  File ".../lib/python3.12/site-packages/google/api_core/retry/retry_base.py", line 230, in _retry_error_helper
    raise final_exc from source_exc
google.api_core.exceptions.RetryError: Timeout of 60.0s exceeded, last exception: 503 Getting metadata from plugin failed with error: Reauthentication is needed. Please run `gcloud auth application-default login` to reauthenticate.
Reproduction steps: expected results

We'd expect these calls to fail immediately.

OS & version + platform

No response

Python environment

No response

Python dependencies

No response

Additional context

No response

Ngôn ngữ chính
Python
Star
5.4k
Fork
1.8k
Merge trung bình
2 ngày 22 giờ
Pull request đã merge (30 ngày)
102

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của googleapis/google-cloud-python

Tất cả issue của googleapis/google-cloud-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.