Skip to content

Axum 7.x causes compilation errors.  #738

@dipthegeezer

Description

@dipthegeezer

Hi

I'm fairly new to Rust, so please advise if I'm doing something wrong. I was trying to get the http-axum example working and wanted to use the latest package dependencies. However axum 7.x no longer works - they have just released a braking change which I believe is the issue.

I got the following error:

--> crates/xxxxxx/src/main.rs:45:9
    |
45  |     run(app).await
    |     --- ^^^ the trait `Service<lambda_http::http::Request<lambda_http::Body>>` is not implemented for `Router<_>`
    |     |
    |     required by a bound introduced by this call
    |
    = help: the following other types implement trait `Service<Request>`:
              <Router as Service<axum::http::Request<B>>>
              <Router as Service<IncomingStream<'_>>>
note: required by a bound in `lambda_http::run`
   --> /Users/xxxx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lambda_http-0.8.3/src/lib.rs:191:8
    |
189 | pub async fn run<'a, R, S, E>(handler: S) -> Result<(), Error>
    |              --- required by a bound in this function
190 | where
191 |     S: Service<Request, Response = R, Error = E>,
    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `run`

My Cargo file dependency looks like this:

[dependencies]
lambda_http = "0.8.3"
lambda_runtime = "0.8.3"
tokio = { version = "1.34.0", features = ["macros"] }
tracing = { version = "0.1.40", features = ["log"] }
tracing-subscriber = { version = "0.3.18", default-features = false, features = ["fmt"] }
axum = "0.7.1"
serde_json = "1.0.108"

I have downgraded in the meantime to stick to the example given but I thought I would bring this to your attention.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions