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

Recent AWS SSO Config change are raising InvalidConfigError on old botocore #995

Closed
4 of 6 tasks
ianliu opened this issue Feb 2, 2023 · 1 comment · Fixed by #999
Closed
4 of 6 tasks

Recent AWS SSO Config change are raising InvalidConfigError on old botocore #995

ianliu opened this issue Feb 2, 2023 · 1 comment · Fixed by #999

Comments

@ianliu
Copy link

ianliu commented Feb 2, 2023

Describe the bug
After an update on AWS CLI and reconfiguring my SSO session, I've started getting InvalidConfigError on projects using aiobotocore because of the botocore version. The exception is as follows:

/tmp/test-sso/test-sso.py:9: DeprecationWarning: There is no current event loop
  loop = asyncio.get_event_loop()
Traceback (most recent call last):
  File "/tmp/test-sso/test-sso.py", line 10, in <module>
    loop.run_until_complete(main())
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/tmp/test-sso/test-sso.py", line 6, in main
    cred = await session.get_credentials()
  File "/tmp/test-sso/venv/lib/python3.10/site-packages/aiobotocore/session.py", line 79, in get_credentials
    self._credentials = await (
  File "/tmp/test-sso/venv/lib/python3.10/site-packages/aiobotocore/credentials.py", line 951, in load_credentials
    creds = await provider.load()
  File "/tmp/test-sso/venv/lib/python3.10/site-packages/aiobotocore/credentials.py", line 1037, in load
    sso_config = self._load_sso_config()
  File "/tmp/test-sso/venv/lib/python3.10/site-packages/botocore/credentials.py", line 2236, in _load_sso_config
    raise InvalidConfigError(
botocore.exceptions.InvalidConfigError: The profile "mlengineer" is configured to use SSO but is missing required configuration: sso_start_url, sso_region

This is very inconvenient because now I have to export my AWS environment variables every time I want to deal with anything related to aiobotocore.

Checklist

  • I have reproduced in environment where pip check passes without errors
  • I have provided pip freeze results
  • I have provided sample code or detailed way to reproduce
  • I have tried the same code in botocore to ensure this is an aiobotocore specific issue
  • I have tried similar code in aiohttp to ensure this is is an aiobotocore specific issue
  • I have checked the latest and older versions of aiobotocore/aiohttp/python to see if this is a regression / injection

pip freeze results

./venv/bin/python -m pip freeze                                                                         ian@batata
aiobotocore==2.4.2
aiohttp==3.8.3
aioitertools==0.11.0
aiosignal==1.3.1
async-timeout==4.0.2
attrs==22.2.0
botocore==1.27.59
charset-normalizer==2.1.1
frozenlist==1.3.3
idna==3.4
jmespath==1.0.1
multidict==6.0.4
python-dateutil==2.8.2
six==1.16.0
urllib3==1.26.14
wrapt==1.14.1
yarl==1.8.2

Environment:

  • Python Version: 3.10.9
  • OS name and version: Arch Linux

Sample code

import asyncio
from aiobotocore.session import get_session

async def main():
    session = get_session()
    cred = await session.get_credentials()
    print(cred)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Additional context

You must first have a working SSO config with aws configure sso and aws sso login with the latest AWS CLI. This will create an invalid configuration for aiobotocore.

The exception is happening in the botocore library itself. I've bisected the botocore version to find where it starts working, and I can state that botocore==1.29.10 is the first version that starts working with the new SSO config scheme.

@ianliu
Copy link
Author

ianliu commented Feb 3, 2023

The AWS CLI version that started with the new SSO Config scheme is 2.9.0, if I configure the SSO with 2.8.13 the test code works.

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.

1 participant