Aws sdk for dynamoDB doesn't initializes the credentials statically

Recently I was working with aws-sdk-dynamodb was trying to initialize the client by passing the values for DynamoDB client so that I can have static initialization of credentials

pub static ref DB_AWS: AsyncOnce<Client> = AsyncOnce::new(async {
        // use aws_types::sdk_config::Builder;
        
        let region = KEY_MAP
        .get(&"aws_region".to_string())
        .unwrap_or(&"ap-south-1".to_string())
        .to_owned();
        
        let url = KEY_MAP
        .get(&"aws_region_url".to_string())
        .unwrap_or(&format!("https://dynamodb.{}.amazonaws.com/", region))
        .to_owned()
        .parse::<Uri>()
        .unwrap();
        
        let AK = KEY_MAP.get(&"db-access-key".to_string()).unwrap();
        let sec_ak = KEY_MAP.get(&"db-secret-access-key".to_string()).unwrap();

        // let creds = Credentials::from_keys(AK, sec_ak, None);


         // creds values are initialized  
        let db_creds = aws_sdk_dynamodb::Credentials::new(AK, sec_ak, None, None, "AWS");

       //values are passed to the builder
        let mut dynamodb_local_config = aws_sdk_dynamodb::config::Builder::new()
            .retry_config(RetryConfig::new().with_max_attempts(2))
            .credentials_provider(db_creds)
            .region(Region::new(region))
            .endpoint_resolver(Endpoint::immutable(url));
        
        dynamodb_local_config.set_sleep_impl(None);            

        let client = Client::from_conf(dynamodb_local_config.build());
        return client;
        
    });

and warning I get during the runtime while trying to though it compiles flawlessly
but still the credentials of aws passed to it doesn't makes any calls

here is the warning

WARN aws_smithy_client::builder: Retries require a `sleep_impl`, but none was passed into the builder. No retries will occur with the current configuration. If this was intentional, you can suppress this message with `Client::set_sleep_impl(None). Otherwise, unless you have a good reason to use the low-level service client API, consider using the `aws-config` crate to load a shared config from the environment, and construct a fluent client from that. 
If you need to use the low-level service client API, then pass in a sleep implementation to make timeouts and retry work.

Can somebody please help me find out why these credentials are not initializing the values?
for more reference to the project you can check out my repo here

I see the same warning with my DynamoDB code, but I just ignore it, and the code still works.

The fact that it says you can disable the warning by calling set_sleep_impl(), but calling set_sleep_impl(None) doesn't disable the warning, seems like a bug in the SDK.

well I found out afterwards that, this whole same piece of code works absolutely fine within the scope of the functions call link to the gist but the issue I think in the previous code block was regarding the lifetime of the variables initialized

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.