From 01763cad999d6be6ea924dcf8b09e3657ab71549 Mon Sep 17 00:00:00 2001 From: Ion Koutsouris <15728914+ion-elgreco@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:31:17 +0200 Subject: [PATCH] fix: set token provider explicitly --- crates/aws/src/storage.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/crates/aws/src/storage.rs b/crates/aws/src/storage.rs index d5609d321d..e8bad40eb1 100644 --- a/crates/aws/src/storage.rs +++ b/crates/aws/src/storage.rs @@ -1,5 +1,6 @@ //! AWS S3 storage backend. +use aws_config::default_provider::token::DefaultTokenChain; use aws_config::meta::region::ProvideRegion; use aws_config::provider_config::ProviderConfig; use aws_config::{Region, SdkConfig}; @@ -208,6 +209,16 @@ impl S3StorageOptions { imds_timeout, &provider_config, ); + + let token_provider: DefaultTokenChain = execute_sdk_future( + DefaultTokenChain::builder() + .region(crate::credentials::new_region_provider( + disable_imds, + imds_timeout, + )) + .build(), + )?; + #[cfg(feature = "native-tls")] let sdk_config = execute_sdk_future( loader @@ -217,11 +228,16 @@ impl S3StorageOptions { .unwrap_or(false), )) .credentials_provider(credentials_provider) + .token_provider(token_provider) .load(), )?; #[cfg(feature = "rustls")] - let sdk_config = - execute_sdk_future(loader.credentials_provider(credentials_provider).load())?; + let sdk_config = execute_sdk_future( + loader + .credentials_provider(credentials_provider) + .token_provider(token_provider) + .load(), + )?; Ok(Self { virtual_hosted_style_request,