smithy-rs icon indicating copy to clipboard operation
smithy-rs copied to clipboard

Update rust-runtime to rustls 0.22

Open djc opened this issue 1 year ago • 6 comments

Motivation and Context

Would be nice to avoid duplicate dependencies in downstream projects and generally keep up with dependencies offering their latest and (supposedly) greatest versions. While rustls 0.23 has since been released (a few days ago -- there's no compatible tokio-rustls or hyper-rustls releases yet), the 0.22 release made quite some changes that will be necessary for 0.23, so I think it still makes sense to make this upgrade.

(Note that hyper-rustls has since upgraded to hyper 1, so we'll probably need #1925 before we can upgrade to the hyper-rustls release that is compatible with rustls 0.23.)

Description

I've attempted to update rustls and related crates in the rust-runtime. So far I have not touched the tls-stub in ci-resources because I'm unable to compile it for reasons that aren't clear to me:

djc-2021 rustls-0.22 tls-stub $ cargo c
error: failed to get `aws-config` as a dependency of package `stub v0.1.0 (/Users/djc/src/smithy-rs/tools/ci-resources/tls-stub)`

Caused by:
  failed to load source for dependency `aws-config`

Caused by:
  Unable to update /Users/djc/src/smithy-rs/aws/sdk/build/aws-sdk/sdk/aws-config

Caused by:
  failed to read `/Users/djc/src/smithy-rs/aws/sdk/build/aws-sdk/sdk/aws-config/Cargo.toml`

Caused by:
  No such file or directory (os error 2)

I also haven't touched the examples yet.

Testing

No testing so far other than just compiling.

Checklist

  • [ ] I have updated CHANGELOG.next.toml if I made changes to the smithy-rs codegen or runtime crates
  • [ ] I have updated CHANGELOG.next.toml if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

djc avatar Mar 04 '24 15:03 djc

failed to load source for dependency aws-config

The aws-config runtime crate depends on some of the code generated crates, so you have to generate a SDK in order for some stuff to compile successfully. You can do this by running ./gradlew aws:sdk:assemble.

jdisanti avatar Mar 04 '24 18:03 jdisanti

This is awesome! And Hyper 1.0 is coming soon: #3461!

Looks like one compilation failure in CI: https://github.com/smithy-lang/smithy-rs/actions/runs/8143069068/job/22260899311?pr=3458#step:3:1112

rcoh avatar Mar 05 '24 17:03 rcoh

@rcoh if you're working on that PR, is it still useful for me to consider pushing this through?

djc avatar Mar 05 '24 18:03 djc

@rcoh if you're working on that PR, is it still useful for me to consider pushing this through?

@rcoh do you have some more context on your plans for landing Hyper 1 support? I skimmed the changes in #3461, but given the creation of an "experimental" crate I'm wondering how you're planning to roll this out -- mainly to determine whether it's useful to continue pushing on this PR.

djc avatar Mar 07 '24 17:03 djc

Yeah I think it is useful. I don't know our exact timeline for stabilizing hyper 1.0 — depends on the balance between community demand and any stability issues that come up

rcoh avatar Mar 07 '24 17:03 rcoh

@djc If you'd like to be an early adopter of the hyper 1.0 client, here's a quick example:

use aws_smithy_experimental::hyper_1_0::{ CryptoMode, HyperClientBuilder };
use aws_smithy_runtime_api::client::behavior_version::BehaviorVersion;

#[tokio::main]
async fn main() {
    let http_client = HyperClientBuilder::default()
        // Here is were we choose a crypto mode.
        //
        // Our choices are:
        //
        // - `CryptoMode::Ring`
        // - `CryptoMode::AwsLc`
        // - `CryptoMode::AwsLcFips`
        //
        // In this example, we've chosen `ring` as the crypto provider.   
        .crypto_mode(CryptoMode::Ring)
        .build_https();
    let conf = aws_config::defaults(BehaviorVersion::latest())
        // Once we've built our client, all we need to do is set it
        // on either the shared config struct or the service config struct.
        .http_client(http_client)
        .load()
        .await;
    let client = aws_sdk_s3::Client::new(&conf);
    let buckets = client
        .list_buckets()
        .send()
        .await
        .expect("failed to list buckets");
    for bucket in buckets.buckets() {
        println!("{}", bucket.name().unwrap());
    }
}

Velfi avatar May 10 '24 18:05 Velfi

Quite a long time, now hyper is 1.5, and hyper-rustls is v0.27.5, is this pr still updated?

getong avatar Jan 04 '25 04:01 getong

Nope, I'm no longer motivated to work on this (unless someone wants to fund the work).

djc avatar Jan 06 '25 09:01 djc