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

Endpoint Trait misbehaving in 0.7 #444

Open
Licenser opened this issue Apr 20, 2020 · 2 comments
Open

Endpoint Trait misbehaving in 0.7 #444

Licenser opened this issue Apr 20, 2020 · 2 comments

Comments

@Licenser
Copy link

I updated from 0.6 to 0.7 and none of the endpoints are working any more with an extremely strange compilation error:

   --> tremor-server/src/main.rs:202:24
    |
202 |     app.at("/version").get(api::version::get);
    |                        ^^^ expected enum `tremor_api::api::Error`, found struct `http_types::error::Error`
    |
    = note: expected enum `std::result::Result<tide::response::Response, tremor_api::api::Error>`
               found enum `std::result::Result<_, http_types::error::Error>`
    = note: required because of the requirements on the impl of `tide::endpoint::Endpoint<tremor_api::api::State>` for `fn(tide::request::Request<tremor_api::api::State>) -> impl std::future::Future {tremor_api::api::version::get}`

Now this wouldn't be so strange if not the implementation for api::version::get would be (where crate == api):

pub async fn get(req: Request) -> std::result::Result<Response, crate::Error> {
    reply(req, Version::default(), false, StatusCode::Ok).await
}
@Licenser
Copy link
Author

ci failure for this (with full context) is here: tremor-rs/tremor-runtime#187

@Licenser
Copy link
Author

The solution seems to be this change:

    app.at("/version").get(api::version::get);

to

    app.at("/version").get(|r| async { Ok(api::version::get(r).await?) } );

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