-
Notifications
You must be signed in to change notification settings - Fork 24
Profile name with space #72
-
I use export export AWS_PROFILE='<profile name>'; aws sso login to login.
After that, aws s3 ls s3://<bucket-name>/ cli works for me.
However, stu --profile $AWS_PROFILE --bucket <bucket-name> fails for me.
Example output:
Am I doing something wrong?
Anything I can collect for troubleshooting?
Beta Was this translation helpful? Give feedback.
All reactions
I noticed that MacBook Pro and 'MacBook Pro' are not exactly the same, so I edited my config, removed the space and the quotes and initiated the sso login again.
This time, running stu, the error was different.
So I believe there is at least one bug - and that is the mishandling of quoted profile names.
error until succeed
The error was a redirect message, where aws states that the region for the bucket is us-east-1 and it redirects there.
The SSO region must be eu-west-1 (I tested), and so without --region option, stu breaks here, where the aws cli seems to just redirect.
Here is the obfuscated error (I added line breaks and indentations) when running stu --bucket <my bucket> without --r...
Replies: 1 comment 2 replies
-
- Does
aws s3 ls s3://<bucket-name>/ --profile $AWS_PROFILEwork correctly? - Is the output from
~/.stu/error.loghelpful?
Beta Was this translation helpful? Give feedback.
All reactions
-
Yes, with or without --profile, the aws s3 ls command works, I just tested it to confirm.
There is an error:
ProfileFile provider could not be built: sso-session named
MacBook Pro(referenced by profile<profile name>) was not found"
cat /Users/gal.szkolnik/.stu/error.log
2025年05月03日 09:19:59.012506 -04:00 Failed to load objects: DispatchFailure(DispatchFailure { source: ConnectorError { kind: Other(None), source: InvalidConfiguration(InvalidConfiguration { source: "ProfileFile provider could not be built: sso-session named `MacBook Pro` (referenced by profile `<profile name>`) was not found" }), connection: Unknown } })
Indeed, the session name is 'MacBook Pro'
Here is my ~/.aws/config:
[default] output = json [profile <profile name>] sso_session = MacBook Pro sso_account_id = <accound id #> sso_role_name = <role name> region = eu-west-1 [sso-session 'MacBook Pro'] sso_start_url = https://d-<obfuscated>.awsapps.com/start/# sso_region = eu-west-1 sso_registration_scopes = sso:account:access
Beta Was this translation helpful? Give feedback.
All reactions
-
I noticed that MacBook Pro and 'MacBook Pro' are not exactly the same, so I edited my config, removed the space and the quotes and initiated the sso login again.
This time, running stu, the error was different.
So I believe there is at least one bug - and that is the mishandling of quoted profile names.
error until succeed
The error was a redirect message, where aws states that the region for the bucket is us-east-1 and it redirects there.
The SSO region must be eu-west-1 (I tested), and so without --region option, stu breaks here, where the aws cli seems to just redirect.
Here is the obfuscated error (I added line breaks and indentations) when running stu --bucket <my bucket> without --region us-east-1
2025年05月03日 10:06:42.414184 -04:00 Failed to load objects:
ServiceError( ServiceError {
source: Unhandled( Unhandled {
source: ErrorMetadata {
code: Some("PermanentRedirect"),
message: Some("The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint."),
extras: Some({
"aws_request_id": "<request id>",
"s3_extended_request_id": "<extended request id>"
})
},
meta: ErrorMetadata {
code: Some("PermanentRedirect"),
message: Some("The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint."),
extras: Some({
"aws_request_id": "<request id>",
"s3_extended_request_id": "<extended request id>"
})
}
}),
raw: Response {
status: StatusCode(301),
headers: Headers {
headers: {
"x-amz-bucket-region": HeaderValue { _private: H1("us-east-1") },
"x-amz-request-id": HeaderValue { _private: H1("<request id>") },
"x-amz-id-2": HeaderValue { _private: H1("<extended request id>") },
"content-type": HeaderValue { _private: H1("application/xml") },
"transfer-encoding": HeaderValue { _private: H1("chunked") },
"date": HeaderValue { _private: H1("Sat, 03 May 2025 14:06:41 GMT") },
"server": HeaderValue { _private: H1("AmazonS3") }
}
},
body: SdkBody {
inner: Once(Some(b"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>PermanentRedirect</Code><Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message><Endpoint>s3.amazonaws.com</Endpoint><Bucket><--bucket name--></Bucket><RequestId><request id></RequestId><HostId><extended request id></HostId></Error>")), retryable: true
}, extensions: Extensions { extensions_02x: Extensions, extensions_1x: Extensions
}
}
})
As you'll notice, the x-amz-bucket-region header in the response, states us-east-1
Adding --region us-east-1 solved the issue for me, no need for --profile
Not sure whether you will consider it a bug, but at least this might help others should they encounter this error.
Thanks for this awesome tool.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1