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

Profile not found on profile names containing a "." #5449

Closed
3 tasks done
huyhua-nvg opened this issue Nov 3, 2023 · 2 comments · Fixed by smithy-lang/smithy-typescript#1067
Closed
3 tasks done
Assignees
Labels
bug This issue is a bug. needs-review This issue/pr needs review from an internal developer. p2 This is a standard priority issue

Comments

@huyhua-nvg
Copy link

huyhua-nvg commented Nov 3, 2023

Checkboxes for prior research

Describe the bug

Our company uses aws-sso-util to populate the aws sso profiles on config file
A profile usually looks like this

[profile aws_re-someservice-dev.AdminPermissionSet]
sso_start_url = https://<company>.awsapps.com/start
sso_region = eu-central-1
sso_account_name = aws_re-someservice-dev
sso_account_id = ACCOUNTID
sso_role_name = AdminPermissionSet
region = AWS_REGION
credential_process = aws-sso-util credential-process --profile aws_re-someservice-dev.AdminPermissionSet
sso_auto_populated = true

I get an error saying that the profile cannot be found. I've debugged this and @smithy/shared-ini-file-loader doesn't like AWS CLI profile names which contain a . character. There is a regex called prefixKeyRegex which fails on such names and goes into the wrong code path.

In the aws docs there's no mention of forbidding a "." on the name, and the cli works fine for this kind of format.

SDK version number

@smithy/[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v18.18.0

Reproduction Steps

import { S3 } from "@aws-sdk/client-s3";
import { fromIni } from "@aws-sdk/credential-providers";

const s3 = new S3({
region: "eu-central-1",
credentials: fromIni({ profile: "other.account" }),
});

async function main() {
const result = await s3.listBuckets({});
console.log(result);
}

main();

Observed Behavior

node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveProfileData.js:30
throw new property_provider_1.CredentialsProviderError(Profile ${profileName} could not be found or parsed in shared credentials file.);
^
CredentialsProviderError: Profile other.account could not be found or parsed in shared credentials file.
at resolveProfileData (projects/assume/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveProfileData.js:30:11)
at projects/assume/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/fromIni.js:9:56
at async coalesceProvider (projects/assume/node_modules/@smithy/property-provider/dist-cjs/memoize.js:14:24)
at async SignatureV4.credentialProvider (projects/assume/node_modules/@smithy/property-provider/dist-cjs/memoize.js:33:24)
at async SignatureV4.signRequest (projects/assume/node_modules/@smithy/signature-v4/dist-cjs/SignatureV4.js:106:29)
at async projects/assume/node_modules/@aws-sdk/middleware-signing/dist-cjs/awsAuthMiddleware.js:16:18
at async projects/assume/node_modules/@smithy/middleware-retry/dist-cjs/retryMiddleware.js:27:46
at async projects/assume/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/region-redirect-endpoint-middleware.js:14:24
at async projects/assume/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/region-redirect-middleware.js:9:20
at async projects/assume/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:7:26 {
tryNextLink: true,
'$metadata': { attempts: 1, totalRetryDelay: 0 }

Expected Behavior

A listing of buckets

Possible Solution

No response

Additional Information/Context

Similar issue raised in smithy: smithy-lang/smithy-typescript#1053

@huyhua-nvg huyhua-nvg added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 3, 2023
@RanVaknin
Copy link
Contributor

Hi @huyhua-nvg ,

I can confirm that this is an issue and reproducible. However changing the regex value alone did not fix the issue.
We will investigate this and get back to you.

Thanks,
Ran~

@RanVaknin RanVaknin self-assigned this Nov 6, 2023
@RanVaknin RanVaknin added needs-review This issue/pr needs review from an internal developer. p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Nov 6, 2023
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug. needs-review This issue/pr needs review from an internal developer. p2 This is a standard priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants