aws-sdk-rust: set credentials_provider not working
Describe the bug
When building config for client, Builder::credentials_provider does the following things:
/// Sets the credentials provider for this service
pub fn credentials_provider(
mut self,
credentials_provider: impl crate::config::ProvideCredentials + 'static,
) -> Self {
self.set_credentials_provider(::std::option::Option::Some(
crate::config::SharedCredentialsProvider::new(credentials_provider),
));
self
}
/// Sets the credentials provider for this service
pub fn set_credentials_provider(
&mut self,
credentials_provider: ::std::option::Option<crate::config::SharedCredentialsProvider>,
) -> &mut Self {
if let Some(credentials_provider) = credentials_provider {
#[cfg(feature = "sigv4a")]
{
self.runtime_components.push_identity_resolver(
::aws_runtime::auth::sigv4a::SCHEME_ID,
credentials_provider.clone(),
);
}
self.runtime_components.push_identity_resolver(
::aws_runtime::auth::sigv4::SCHEME_ID,
credentials_provider,
);
}
self
}
credientials_provider is set by runtime_components. But after build, Config::credientials_provider does this:
/// Returns the credentials provider for this service
pub fn credentials_provider(&self) -> Option<crate::config::SharedCredentialsProvider> {
self.config
.load::<crate::config::SharedCredentialsProvider>()
.cloned()
}
It loads credentials provider from its config field not runtime_components. So it is always None. And I cannot make my hard-coded credentials for minio test env work.
Expected Behavior
Builder::credentials_provider set the right field or Config::credentials_provider get from the right field.
Current Behavior
Builder::credentials_provider set runtime_components but Config::credentials_provider get from config.
Reproduction Steps
Set any credentials provider and get, got None.
Possible Solution
As mentioned.
Additional Information/Context
No response
Version
├── aws-credential-types v1.0.0
│ ├── aws-smithy-async v1.0.1
│ ├── aws-smithy-runtime-api v1.0.1
│ │ ├── aws-smithy-async v1.0.1 (*)
│ │ ├── aws-smithy-types v1.0.1
│ ├── aws-smithy-types v1.0.1 (*)
├── aws-runtime v1.0.0
│ ├── aws-credential-types v1.0.0 (*)
│ ├── aws-http v0.60.0
│ │ ├── aws-smithy-runtime-api v1.0.1 (*)
│ │ ├── aws-smithy-types v1.0.1 (*)
│ │ ├── aws-types v1.0.0
│ │ │ ├── aws-credential-types v1.0.0 (*)
│ │ │ ├── aws-smithy-async v1.0.1 (*)
│ │ │ ├── aws-smithy-runtime-api v1.0.1 (*)
│ │ │ ├── aws-smithy-types v1.0.1 (*)
│ ├── aws-sigv4 v1.0.0
│ │ ├── aws-credential-types v1.0.0 (*)
│ │ ├── aws-smithy-eventstream v0.60.0
│ │ │ ├── aws-smithy-types v1.0.1 (*)
│ │ ├── aws-smithy-http v0.60.0
│ │ │ ├── aws-smithy-eventstream v0.60.0 (*)
│ │ │ ├── aws-smithy-runtime-api v1.0.1 (*)
│ │ │ ├── aws-smithy-types v1.0.1 (*)
│ │ ├── aws-smithy-runtime-api v1.0.1 (*)
│ │ ├── aws-smithy-types v1.0.1 (*)
│ ├── aws-smithy-async v1.0.1 (*)
│ ├── aws-smithy-eventstream v0.60.0 (*)
│ ├── aws-smithy-http v0.60.0 (*)
│ ├── aws-smithy-runtime-api v1.0.1 (*)
│ ├── aws-smithy-types v1.0.1 (*)
│ ├── aws-types v1.0.0 (*)
├── aws-sdk-s3 v0.39.1
│ ├── aws-credential-types v1.0.0 (*)
│ ├── aws-http v0.60.0 (*)
│ ├── aws-runtime v1.0.0 (*)
│ ├── aws-sigv4 v1.0.0 (*)
│ ├── aws-smithy-async v1.0.1 (*)
│ ├── aws-smithy-checksums v0.60.0
│ │ ├── aws-smithy-http v0.60.0 (*)
│ │ ├── aws-smithy-types v1.0.1 (*)
│ ├── aws-smithy-eventstream v0.60.0 (*)
│ ├── aws-smithy-http v0.60.0 (*)
│ ├── aws-smithy-json v0.60.0
│ │ └── aws-smithy-types v1.0.1 (*)
│ ├── aws-smithy-runtime v1.0.1
│ │ ├── aws-smithy-async v1.0.1 (*)
│ │ ├── aws-smithy-http v0.60.0 (*)
│ │ ├── aws-smithy-runtime-api v1.0.1 (*)
│ │ ├── aws-smithy-types v1.0.1 (*)
│ ├── aws-smithy-runtime-api v1.0.1 (*)
│ ├── aws-smithy-types v1.0.1 (*)
│ ├── aws-smithy-xml v0.60.0
│ ├── aws-types v1.0.0 (*)
├── aws-sigv4 v1.0.0 (*)
├── aws-smithy-runtime v1.0.1 (*)
├── aws-smithy-types v1.0.1 (*)
│ ├── aws-config v1.0.0
│ │ ├── aws-credential-types v1.0.0 (*)
│ │ ├── aws-http v0.60.0 (*)
│ │ ├── aws-runtime v1.0.0 (*)
│ │ ├── aws-sdk-sts v0.39.0
│ │ │ ├── aws-credential-types v1.0.0 (*)
│ │ │ ├── aws-http v0.60.0 (*)
│ │ │ ├── aws-runtime v1.0.0 (*)
│ │ │ ├── aws-smithy-async v1.0.1 (*)
│ │ │ ├── aws-smithy-http v0.60.0 (*)
│ │ │ ├── aws-smithy-json v0.60.0 (*)
│ │ │ ├── aws-smithy-query v0.60.0
│ │ │ │ ├── aws-smithy-types v1.0.1 (*)
│ │ │ ├── aws-smithy-runtime v1.0.1 (*)
│ │ │ ├── aws-smithy-runtime-api v1.0.1 (*)
│ │ │ ├── aws-smithy-types v1.0.1 (*)
│ │ │ ├── aws-smithy-xml v0.60.0 (*)
│ │ │ ├── aws-types v1.0.0 (*)
│ │ ├── aws-smithy-async v1.0.1 (*)
│ │ ├── aws-smithy-http v0.60.0 (*)
│ │ ├── aws-smithy-json v0.60.0 (*)
│ │ ├── aws-smithy-runtime v1.0.1 (*)
│ │ ├── aws-smithy-runtime-api v1.0.1 (*)
│ │ ├── aws-smithy-types v1.0.1 (*)
│ │ ├── aws-types v1.0.0 (*)
│ ├── aws-smithy-http v0.60.0 (*)
│ ├── aws-smithy-runtime v1.0.1 (*)
│ ├── aws-smithy-runtime-api v1.0.1 (*)
│ ├── aws-smithy-types v1.0.1 (*)
│ ├── madsim-aws-sdk-s3 v0.4.0+0.39
│ │ └── aws-sdk-s3 v0.39.1 (*)
│ ├── aws-config v1.0.0 (*)
│ ├── aws-credential-types v1.0.0 (*)
│ ├── aws-sdk-kinesis v0.39.1
│ │ ├── aws-credential-types v1.0.0 (*)
│ │ ├── aws-http v0.60.0 (*)
│ │ ├── aws-runtime v1.0.0 (*)
│ │ ├── aws-smithy-async v1.0.1 (*)
│ │ ├── aws-smithy-http v0.60.0 (*)
│ │ ├── aws-smithy-json v0.60.0 (*)
│ │ ├── aws-smithy-runtime v1.0.1 (*)
│ │ ├── aws-smithy-runtime-api v1.0.1 (*)
│ │ ├── aws-smithy-types v1.0.1 (*)
│ │ ├── aws-types v1.0.0 (*)
│ ├── aws-sdk-s3 v0.39.1 (*)
│ ├── aws-smithy-http v0.60.0 (*)
│ ├── aws-smithy-runtime-api v1.0.1 (*)
│ ├── aws-smithy-types v1.0.1 (*)
│ ├── aws-types v1.0.0 (*)
├── aws-config v1.0.0 (*)
├── aws-sdk-s3 v0.39.1 (*)
├── aws-smithy-http v0.60.0 (*)
├── aws-smithy-types v1.0.1 (*)
│ │ │ │ ├── aws-config v1.0.0 (*)
│ │ │ │ ├── aws-sdk-ec2 v0.39.1
│ │ │ │ │ ├── aws-credential-types v1.0.0 (*)
│ │ │ │ │ ├── aws-http v0.60.0 (*)
│ │ │ │ │ ├── aws-runtime v1.0.0 (*)
│ │ │ │ │ ├── aws-smithy-async v1.0.1 (*)
│ │ │ │ │ ├── aws-smithy-http v0.60.0 (*)
│ │ │ │ │ ├── aws-smithy-json v0.60.0 (*)
│ │ │ │ │ ├── aws-smithy-query v0.60.0 (*)
│ │ │ │ │ ├── aws-smithy-runtime v1.0.1 (*)
│ │ │ │ │ ├── aws-smithy-runtime-api v1.0.1 (*)
│ │ │ │ │ ├── aws-smithy-types v1.0.1 (*)
│ │ │ │ │ ├── aws-smithy-xml v0.60.0 (*)
│ │ │ │ │ ├── aws-types v1.0.0 (*)
├── madsim-aws-sdk-s3 v0.4.0+0.39 (*)
Environment details (OS name and version, etc.)
Linux / Mac
Logs
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 15 (3 by maintainers)
Commits related to this issue
- fix: fix credentials provider upstream issue: https://github.com/awslabs/aws-sdk-rust/issues/973 Signed-off-by: MrCroxx <mrcroxx@outlook.com> — committed to risingwavelabs/risingwave by MrCroxx 3 years ago
- Fix `config::Builder::set_credentials_provider` to override what's previsouly set (#3278) ## Motivation and Context Fixes https://github.com/awslabs/aws-sdk-rust/issues/973 ## Description Prior ... — committed to smithy-lang/smithy-rs by ysaito1001 3 years ago
I think we could make this accessor work properly—I agree the current behavior is pretty confusing. Setting the credentials provider should definitely be working though—so let us know the behavior. you’re seeing