Profile not found on profile names containing a "." #5449
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
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
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
The text was updated successfully, but these errors were encountered: