Skip to content

@aws-sdk/credential-providers: SSO Auth doesn't work if sso-session contains a space #7225

@cwangsmv

Description

@cwangsmv

Checkboxes for prior research

Describe the bug

When using AWS js sdk with white space in sso_session, it will fail and throws Cannot read properties of undefined (reading 'sso_region') exception.

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/credential-providers

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

node v22.14.0

Reproduction Steps

AWS Config file:

[profile user-xxx]
sso_session = test sso
...
[sso-session 'test sso']
...

Using this SSO credential file in JS SDK will throws Cannot read properties of undefined (reading 'sso_region') exception

const credentials = fromSSO({
  profile: "user-xxx",
});
const stsClient = new STSClient({
  region: "ap-southeast-2",
  credentials,
});
const response = await stsClient.send(new GetCallerIdentityCommand({}));

But this config is working well with AWS CLI

Observed Behavior

It should be worked like AWS CLI

Expected Behavior

Using this SSO credential file in JS SDK will throws Cannot read properties of undefined (reading 'sso_region') exception

Possible Solution

No response

Additional Information/Context

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p2This is a standard priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions