You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I determined this is the correct repository in which to report this bug.
Summary of the issue
Context
I am trying to use async client for the GCP Secret Manager in my Telegram bot. I want to create, store and access the secret. I am running this bot in GKE autopilot.
Expected Behavior:
I expect to be able to create the secret asynchronously.
Actual Behavior:
When attempting to call create_secret, you get an error. This error only occurs when I use the secret manager together with the python-telegram-bot library, but both work on their own. This leads me to believe that one of them is not handling the asyncio loop correctly or making a new loop when it shouldn't be.
GKE autopilot cluster, or another cluster that has enough permissions to access GCP secret manager
kubectl and helm, pointing to the cluster
git clone https://github.com/rdong8/experiments && cd experiments
Create a .env file with a Telegram BOT_TOKEN and GCP_PROJECT_ID - the schema is in the .env.template file. You can get a Telegram bot token by messaging BotFather. Do not use quotes around the values.
Create a secret using that file: kubectl create secret generic experiments-secret -n test --create-namespace --from-env-file=.env
Run from the repo root: helm install -n test --set image.tag=f1eede3 experiments charts/experiments
Get the pod ID: kubectl get pods -n test
Watch the logs of the bot: kubectl logs -n test -f pod/<POD ID>
Start a conversation with the bot you created on Telegram
Try to set a secret, ie. send the message /set mysecret
Observe the exception traceback in the logs
Reproduction steps: actual results
No error handlers are registered, logging exception.
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/telegram/ext/_application.py", line 1335, in process_update
await coroutine
File "/usr/local/lib/python3.12/site-packages/telegram/ext/_handlers/basehandler.py", line 158, in handle_update
return await self.callback(update, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/experiments/__main__.py", line 40, in set_secret
await client.create_secret(secret_id=secret_id, parent=parent, secret=secret)
File "/usr/local/lib/python3.12/site-packages/google/cloud/secretmanager_v1/services/secret_manager_service/async_client.py", line 539, in create_secret
response = await rpc(
^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/google/api_core/grpc_helpers_async.py", line 85, in __await__
response = yield from self._call.__await__()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/grpc/aio/_call.py", line 308, in __await__
response = yield from self._call_response
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Task <Task pending name='Application:7717576672:update_fetcher' coro=<Application._update_fetcher() running at /usr/local/lib/python3.12/site-packages/telegram/ext/_application.py:1258>> got Future <Task pending name='Task-19' coro=<UnaryUnaryCall._invoke() running at /usr/local/lib/python3.12/site-packages/grpc/aio/_call.py:577>> attached to a different loop
The text was updated successfully, but these errors were encountered:
rdong8
added
triage me
I really want to be triaged.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
labels
Oct 3, 2024
Determine this is the right repository
Summary of the issue
Context
I am trying to use async client for the GCP Secret Manager in my Telegram bot. I want to create, store and access the secret. I am running this bot in GKE autopilot.
Expected Behavior:
I expect to be able to create the secret asynchronously.
Actual Behavior:
When attempting to call
create_secret
, you get an error. This error only occurs when I use the secret manager together with thepython-telegram-bot
library, but both work on their own. This leads me to believe that one of them is not handling the asyncio loop correctly or making a new loop when it shouldn't be.API client name and version
google-cloud-secret-manager 2.20.2
Reproduction steps: code
See here: https://github.com/rdong8/experiments
Reproduction steps: supporting files
Prerequisites:
kubectl
andhelm
, pointing to the clustergit clone https://github.com/rdong8/experiments && cd experiments
.env
file with a TelegramBOT_TOKEN
andGCP_PROJECT_ID
- the schema is in the.env.template
file. You can get a Telegram bot token by messaging BotFather. Do not use quotes around the values.kubectl create secret generic experiments-secret -n test --create-namespace --from-env-file=.env
helm install -n test --set image.tag=f1eede3 experiments charts/experiments
kubectl get pods -n test
kubectl logs -n test -f pod/<POD ID>
/set mysecret
Reproduction steps: actual results
Reproduction steps: expected results
No output (successfully create secret)
OS & version + platform
General-purpose compute class on GKE autopilot
Python environment
Python 3.12.6
Python dependencies
The text was updated successfully, but these errors were encountered: