rust-s3 icon indicating copy to clipboard operation
rust-s3 copied to clipboard

"with-async-std" feature still depends on Tokio runtime

Open rogercloud opened this issue 3 years ago • 0 comments

Describe the bug Tokio runtime is also a dependency after enabling feature "with-async-std" and turning off default features. The root cause is the hyper-client in surf depends on Tokio runtime, other runtime such as smol will panic. Replacing the hyper-client to h1-client is a possible workaround.

To Reproduce Steps to reproduce the behavior (ideally with a minimal code sample):

use s3::bucket::Bucket;
use s3::bucket_ops::BucketConfiguration;
use s3::creds::Credentials;
use s3::Region;
use smol;

fn main() {
    smol::block_on(async {
        let bucket_name = "rust-s3-test";
        let region = Region::Custom {
            region: "abc".into(),
            endpoint: "http://127.0.0.1:9000".into(),
        };
        let credentials = Credentials::new(
            Some("AKIAIOSFODNN7EXAMPLE"),
            Some("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"),
            None,
            None,
            None,
        )
        .unwrap();

        let config = BucketConfiguration::default();

        Bucket::create_with_path_style(bucket_name, region, credentials, config)
            .await
            .unwrap();
    });
}

The error message is thread 'main' panicked at 'not currently running on the Tokio runtime.'

Expected behavior "with-async-std" should works fine with all the async-std compatable runtimes such as smol.

Environment

  • Rust version: 1.48
  • lib version: 0.27.0-rc3

Additional context Add any other context about the problem here.

rogercloud avatar Apr 19 '21 04:04 rogercloud