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

AttributeError: 'coroutine' object has no attribute 'get_frozen_credentials' #854

Closed
MarkBrook opened this issue Feb 12, 2021 · 1 comment · Fixed by #858
Closed

AttributeError: 'coroutine' object has no attribute 'get_frozen_credentials' #854

MarkBrook opened this issue Feb 12, 2021 · 1 comment · Fixed by #858

Comments

@MarkBrook
Copy link

MarkBrook commented Feb 12, 2021

Error reproduced during role chaining. Used an aws config and created AioSession with profile of my role_two:

[profile role_one]
role_arn=role_one_arn
role_session_name=some_session_name
credential_source=Ec2InstanceMetadata

[profile role_two]
role_arn=role_two_arn
role_session_name=some_session_name
source_profile=role_one

Sample code:

session = AioSession(profile="role_two")
async with session.create_client(
    "s3", region_name="us-east-1"
) as s3_client:
    # any action would work 
    await s3_client.list_buckets()
...

Traceback:

Refreshing temporary credentials failed during mandatory refresh period.
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/credentials.py", line 265, in _protected_refresh
    metadata = await self._refresh_using()
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/credentials.py", line 319, in fetch_credentials
    return await self._get_cached_credentials()
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/credentials.py", line 329, in _get_cached_credentials
    response = await self._get_credentials()
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/credentials.py", line 354, in _get_credentials
    client = await self._create_client()
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/credentials.py", line 360, in _create_client
    frozen_credentials = await self._source_credentials.get_frozen_credentials()
AttributeError: 'coroutine' object has no attribute 'get_frozen_credentials'
2021-02-12 15:54:20,189: ERROR <delete_collected_dings_from_data_aws_account.py:get_uuid> failed to process us_amazon_employees/ding/29797008/6921083684338969232/6921083684338969232.mp4
Traceback (most recent call last):
  File "/ddt/app/scripts/delete_collected_dings_from_data_aws_account.py", line 35, in get_uuid
    Bucket=bucket, Key=file_name.replace(".mp4", ".json")
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/client.py", line 121, in _make_api_call
    operation_model, request_dict, request_context)
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/client.py", line 140, in _make_request
    return await self._endpoint.make_request(operation_model, request_dict)
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/endpoint.py", line 84, in _send_request
    request = await self.create_request(request_dict, operation_model)
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/endpoint.py", line 78, in create_request
    operation_name=operation_model.name)
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/hooks.py", line 27, in _emit
    response = await handler(**kwargs)
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/signers.py", line 16, in handler
    return await self.sign(operation_name, request)
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/signers.py", line 53, in sign
    auth = await self.get_auth_instance(**kwargs)
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/signers.py", line 75, in get_auth_instance
    frozen_credentials = await self._credentials.get_frozen_credentials()
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/credentials.py", line 290, in get_frozen_credentials
    await self._refresh()
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/credentials.py", line 252, in _refresh
    await self._protected_refresh(is_mandatory=is_mandatory_refresh)
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/credentials.py", line 265, in _protected_refresh
    metadata = await self._refresh_using()
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/credentials.py", line 319, in fetch_credentials
    return await self._get_cached_credentials()
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/credentials.py", line 329, in _get_cached_credentials
    response = await self._get_credentials()
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/credentials.py", line 354, in _get_credentials
    client = await self._create_client()
  File "/usr/local/lib/python3.6/site-packages/aiobotocore/credentials.py", line 360, in _create_client
    frozen_credentials = await self._source_credentials.get_frozen_credentials()

I tried similar code with botocore and it works:

session = Session(profile="role_two")
with session.create_client(
    "s3", region_name="us-east-1"
) as s3_client:
   s3_client.list_buckets()

Same for the latest release (1.2.1).
Pip freeze results:

absl-py==0.7.0
aiobotocore==1.0.7
aiofiles==0.5.0
aiohttp==3.6.2
aioitertools==0.7.0
aiostatsd==1.0.0
astor==0.7.1
async-timeout==3.0.1
attrs==18.2.0
awscli==1.18.32
boto==2.49.0
boto3==1.12.32
botocore==1.15.32
bz2file==0.98
certifi==2018.11.29
chardet==3.0.4
click==7.1.1
colorama==0.3.9
cystatsd==1.1.0
Cython==0.29.19
docutils==0.14
gast==0.2.2
grpcio==1.18.0
h5py==2.9.0
idna==2.8
idna-ssl==1.1.0
jmespath==0.9.3
Keras-Applications==1.0.7
Keras-Preprocessing==1.0.9
Markdown==3.0.1
multidict==4.5.2
numpy==1.16.1
protobuf==3.6.1
psutil==5.7.0
psycopg2==2.8.5
pyasn1==0.4.4
python-dateutil==2.8.1
pytz==2018.7
PyYAML==3.13
requests==2.23.0
rsa==3.4.2
s3transfer==0.3.3
six==1.12.0
smart-open==1.8.1
tensorboard==1.12.2
tensorflow==1.12.0
termcolor==1.1.0
typing-extensions==3.7.4.2
urllib3==1.24.1
Werkzeug==0.14.1
wrapt==1.10.11
yarl==1.4.2

Environment:

  • Kubeflow with kiam running on a cluster
  • Python 3.6
  • Docker image with OS Linux 10 (buster)
@thehesiod
Copy link
Collaborator

thanks! will investigate asap if terry doesn't get to it by then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants