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

compute_client_args ignores scoped_config properties - botocore.exceptions.NoRegionError #3016

Closed
p2safu opened this issue Sep 19, 2023 · 1 comment
Labels
bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged.

Comments

@p2safu
Copy link

p2safu commented Sep 19, 2023

Describe the bug

My issue arise when I try to create an Athena client using boto3.client()

The function is executed like this: boto3.client('athena', endpoint_url=None)
Digging into the boto code, I see that at some point it reads AWS config file and populates a variable called scoped_config with the valid values.

When execution reaches compute_client_args() the parameters are:

client_config=None
region_name=None
endpoint_url=None
is_secure=True
scoped_config={
    "output": "json",
    "sso_account_id": "111111111",
    "sso_region": "eu-west-1",
    "sso_role_name": "ViewOnlyAccess",
    "sso_session": "test-session"
}

The error botocore.exceptions.NoRegionError: You must specify a region. is thrown later, from the self._compute_endpoint_config()

What I would expect, is that if region is not defined then it would be derived from the AWS config file (from scoped_config variable)

I have aws config file with session profile that looks like this:

[sso-session  test-session]
sso_start_url = https://test.awsapps.com/start
sso_region = eu-west-1
sso_registration_scopes = sso:account:access

[profile rnd]
sso_account_id = 111111111
sso_role_name = ViewOnlyAccess
sso_session = test-session
output = json

Anything else, like s3 and dynamo, when initialized using boto3.resource() opens connection successfully.

Expected Behavior

region is populated from the scoped_config when undefined explicitly

Current Behavior

Fails on botocore.exceptions.NoRegionError: You must specify a region.

Reproduction Steps

Simple main like this:

if __name__ == '__main__’:
  client = boto3.client('athena', endpoint_url=None)

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1.28.40

Environment details (OS name and version, etc.)

Mac OS Ventura 13.5.2, Python 3.7.9, botocore 1.31.40

@p2safu p2safu added bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Sep 19, 2023
@p2safu p2safu closed this as completed Sep 19, 2023
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant