Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

google-cloud-secret-manager: duration "Fail to convert to Duration" #13350

Open
1 task done
glasnt opened this issue Dec 12, 2024 · 2 comments
Open
1 task done

google-cloud-secret-manager: duration "Fail to convert to Duration" #13350

glasnt opened this issue Dec 12, 2024 · 2 comments
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@glasnt
Copy link
Contributor

glasnt commented Dec 12, 2024

Determine this is the right repository

  • I determined this is the correct repository in which to report this bug.

Summary of the issue

Context

Trying to define a secret duration in "NNx" format (e.g. "300s") fails for latest versions of protobuf bundled with secretmanager.

Expected Behavior:

(No error)

Actual Behavior:

AttributeError: Fail to convert to Duration. Expected a timedelta like object got str: 'str' object has no attribute 'seconds'

API client name and version

google-cloud-secret-manager 2.21.1

Reproduction steps: code

file: main.py

import google.auth
import uuid
from google.cloud import secretmanager

_, project_id = google.auth.default()
client = secretmanager.SecretManagerServiceClient()

parent = f"projects/{project_id}"
ttl = "300s"

response = client.create_secret(
    request={
        "parent": f"projects/{project_id}",
        "secret_id": f"secret_{uuid.uuid4()}",
        "secret": {"replication": {"automatic": {}}, "ttl": "300s"},
    }
)

Reproduction steps: supporting files

No response

Reproduction steps: actual results

AttributeError: Fail to convert to Duration. Expected a timedelta like object got str: 'str' object has no attribute 'seconds'

Reproduction steps: expected results

(Successful creation)

OS & version + platform

MacOS 15.1.1 (24B91)

Python environment

Python 3.13.0

Python dependencies

cachetools==5.5.0
certifi==2024.8.30
charset-normalizer==3.4.0
google-api-core==2.24.0
google-auth==2.37.0
google-cloud-secret-manager==2.21.1
googleapis-common-protos==1.66.0
grpc-google-iam-v1==0.13.1
grpcio==1.68.1
grpcio-status==1.68.1
idna==3.10
proto-plus==1.25.0
protobuf==5.29.1
pyasn1==0.6.1
pyasn1_modules==0.4.1
requests==2.32.3
rsa==4.9
urllib3==2.2.3

Additional context

Dependencies based on a current pip install google-cloud-secret-manager, which comes with protobuf==5.29.1.

Manually running pip install protobuf==5.27.5, the error does not occur.

Error exists from protobuf==5.28.0 onwards, without any changes to any other dependencies.

@glasnt glasnt added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. triage me I really want to be triaged. labels Dec 12, 2024
@parthea parthea assigned parthea and ohmayr and unassigned parthea Dec 12, 2024
@danw-relaytech
Copy link

danw-relaytech commented Dec 13, 2024

My company experienced the same issue but with google-cloud-tasks 2.16.5 using the v2 cloud task client

rolling back to protobuf 5.27.3 resolved it for us

@vchudnov-g vchudnov-g added priority: p2 Moderately-important priority. Fix may not be included in next release. and removed triage me I really want to be triaged. labels Dec 18, 2024
@vchudnov-g
Copy link
Contributor

Thanks for reporting this issue. We'll work with the protobuf team to get this resolved. For now, the workaround of rolling back to protobuf 5.27.x seems to unblock folks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

5 participants