Describe the bug
I'm trying to follow along with the juniper_hyper example code, but it doesn't compile outside of the main project. It looks like juniper_hyper is somehow pulling in an old futures-rs version (0.1.29). Using some RLS source jumping I can see that I jump from
pub fn graphiql(
graphql_endpoint: &str,
) -> impl Future<Item = Response<Body>, Error = hyper::Error> {}
in juniper_hyper-0.5.2 to
pub trait Future {}
in futures-0.1.29. I'm guessing that this version of futures-rs predates std::future.
To Reproduce
Steps to reproduce the behavior:
Cargo.toml:
[package]
name = "api"
version = "0.0.0"
authors = ["Samuel Ainsworth <[email protected]>"]
edition = "2018"
[dependencies]
juniper_hyper = "0.5.2"
tokio = { version = "0.2.11", features = ["macros"] }
src/main:
#[tokio::main]
async fn main() {
juniper_hyper::graphiql("/graphql").await;
}
produces an error:
โฏ cargo run
Compiling api v0.0.0 (/Users/skainswo/dev/cuddlefish/api)
error[E0277]: the trait bound `impl futures::future::Future: std::future::Future` is not satisfied
--> src/main.rs:3:3
|
3 | juniper_hyper::graphiql("/graphql").await;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `impl futures::future::Future`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.
error: could not compile `api`.
Expected behavior
The example code to work.
Additional context
n/a
Looks like the futures version at the time of the last juniper_hyper release (9ce73970500937df7dc10aace1b7907fbc24bb6b) is the problem: https://github.com/graphql-rust/juniper/blob/9ce73970500937df7dc10aace1b7907fbc24bb6b/juniper_hyper/Cargo.toml#L18. So really we just a new version of juniper_hyper to be released.
There is an open PR to update the example to latest futures
I ran into this issue, using the master branch fixed the problem.
juniper_hyper = { git = "https://github.com/graphql-rust/juniper", features = ["async"] }
juniper = { git = "https://github.com/graphql-rust/juniper", features = ["async"] }
@DaleLJefferson when I set juniper to git I get the following build error:
cargo build
Updating git repository `https://github.com/graphql-rust/juniper`
Updating crates.io index
error: failed to select a version for `quote`.
... required by package `serde_derive v1.0.104`
... which is depended on by `juniper v0.14.2 (https://github.com/graphql-rust/juniper#961a0712)`
... which is depended on by `backend v0.1.0 (/home/user/dev/backend)`
versions that meet the requirements `= 1.0.2` are: 1.0.2
all possible versions conflict with previously selected packages.
previously selected package `quote v1.0.3`
... which is depended on by `juniper_codegen v0.14.2 (https://github.com/graphql-rust/juniper#961a0712)`
... which is depended on by `juniper v0.14.2 (https://github.com/graphql-rust/juniper#961a0712)`
... which is depended on by `backend v0.1.0 (/home/user/dev/backend)`
failed to select a version for `quote` which could resolve this conflict
also the async feature is not in juniper
how do you get this working at this stage?
I just removed the async feature yesterday
I'm going to close this, feel free to comment or open a new issue if you think this is in error!
Most helpful comment
Looks like the futures version at the time of the last juniper_hyper release (9ce73970500937df7dc10aace1b7907fbc24bb6b) is the problem: https://github.com/graphql-rust/juniper/blob/9ce73970500937df7dc10aace1b7907fbc24bb6b/juniper_hyper/Cargo.toml#L18. So really we just a new version of juniper_hyper to be released.