Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http-body version incompatible #1243

Open
1 task
lijingrs opened this issue Jan 16, 2025 · 1 comment
Open
1 task

http-body version incompatible #1243

lijingrs opened this issue Jan 16, 2025 · 1 comment
Labels
bug This issue is a bug.

Comments

@lijingrs
Copy link

Describe the bug

error[E0277]: the trait bound axum::body::Bytes: HttpBody is not satisfied because the trait comes from a different crate version

this error comes when I create web app service with axum 0.8

Image Image Image

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

update the htpp-body version

Current Behavior

http-body version too many

Reproduction Steps

it comes with compile time when add aws-sdk-s3 aws-config

aws-config = { version = "1.5.14", features = ["behavior-version-latest"] }
aws-sdk-s3 = { version = "1.69.0"}
axum = { version = "0.8.1" ,features = ["multipart","macros"]}

let client = aws_sdk_s3::Client::new(
&SdkConfig::builder()
.region(Region::new(s3_config.region.clone()))
.endpoint_url(s3_config.endpoint_url.clone())
.behavior_version(BehaviorVersion::latest())
.credentials_provider(SharedCredentialsProvider::new(Credentials::new(
s3_config.access_key_id.clone(),
s3_config.secret_access_key.clone(),
None,
None,
PROVIDER_NAME
)))
.build(),
);

pub async fn upload(&self, data:Bytes, bucket:&str, key:&str) -> CommonResult{
let output = selfclient
.put_object()
.bucket(bucket)
.key(key)
.body(ByteStream::from(data))
.send()
.await?;
let etag = output.e_tag.unwrap_or_else(|| "".to_string());
info!("ETag: {}", etag);
Ok(etag)
}

Possible Solution

No response

Additional Information/Context

No response

Version

aws-config = { version = "1.5.14", features = ["behavior-version-latest"] }
aws-sdk-s3 = { version = "1.69.0"}

Environment details (OS name and version, etc.)

macos

Logs

error[E0277]: the trait bound axum::body::Bytes: HttpBody is not satisfied because the trait comes from a different crate version
--> src/application/system/service/file_service.rs:75:56
|
75 | Path((,id)): Path<(i64,i64)> )-> impl IntoResponse{
| ________________________________________________________^
76 | | let file = FileDomainService::find_by_id(id).await.unwrap();
77 | | if file.is_none(){
78 | | return Err(StatusCode::NOT_FOUND);
... |
89 | | Ok(response)
90 | | }
| |
^ the trait HttpBody is not implemented for axum::body::Bytes
|
note: there are multiple different versions of crate http_body in the dependency graph
--> /Users/lijing/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/http-body-1.0.1/src/lib.rs:38:1
|
38 | pub trait Body {
| ^^^^^^^^^^^^^^ this is the required trait
|
::: src/presentation/router/auth_routes.rs:1:5
|
1 | use axum::Router;
| ---- one version of crate http_body is used here, as a dependency of crate axum_core
|
::: src/infrastructure/utils/aws_s3_util.rs:1:5
|
1 | use aws_config::SdkConfig;
| ---------- one version of crate http_body is used here, as a dependency of crate aws_smithy_types
|
::: /Users/lijing/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/bytes-1.9.0/src/bytes.rs:102:1
|
102 | pub struct Bytes {
| ---------------- this type doesn't implement the required trait
|
::: /Users/lijing/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/http-body-0.4.6/src/collect.rs:14:1
|
14 | / pin_project! {
15 | | /// Future that resolves into a [Collected].
16 | | pub struct Collect
17 | | where
... |
24 | | }
25 | | }
| |_- this is the found trait
= help: you can use cargo tree to explore your dependency tree

@lijingrs lijingrs added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 16, 2025
@ysaito1001
Copy link
Collaborator

Yes, this is due to SDKs today relying on hyper 0.14 and its dependencies.

We've been actively working on making hyper 1.0 as a default HTTP client for the SDKs (hence also upgrading constellation crates like http and http-body to 1.0).

We are carefully planning the rollout, and once Hyper 1.0 is set as the default HTTP client for the SDKs, this error should resolve automatically.

@ysaito1001 ysaito1001 removed the needs-triage This issue or PR still needs to be triaged. label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants