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

Axum 0.8 introduces breaking trait change for the service #56

Open
dlorddd opened this issue Jan 16, 2025 · 0 comments
Open

Axum 0.8 introduces breaking trait change for the service #56

dlorddd opened this issue Jan 16, 2025 · 0 comments

Comments

@dlorddd
Copy link

dlorddd commented Jan 16, 2025

Setting up axum-analytics using the latest Axum v0.8.1 causes the following error:

error[E0277]: the trait bound `AnalyticsMiddleware<Route>: Service<axum::http::Request<axum::body::Body>>` is not satisfied
   --> src/main.rs:157:16
    |
157 |         .layer(Analytics::new(settings.analytics_api_key.clone()))
    |          ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Service<axum::http::Request<axum::body::Body>>` is not implemented for `AnalyticsMiddleware<Route>`
    |          |
    |          required by a bound introduced by this call
    |
    = help: the trait `Service<axum::http::Request<axum_core::body::Body>>` is implemented for `AnalyticsMiddleware<S>`
note: required by a bound in `Router::<S>::layer`
   --> /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/axum-0.8.1/src/routing/mod.rs:300:21
    |
297 |     pub fn layer<L>(self, layer: L) -> Router<S>
    |            ----- required by a bound in this associated function
...
300 |         L::Service: Service<Request> + Clone + Send + Sync + 'static,
    |                     ^^^^^^^^^^^^^^^^ required by this bound in `Router::<S>::layer`

This seems to be the case because Axum 0.8 starts requiring Sync. This should be fixed by updating the trait implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant