graphql-rust / juniper

GraphQL server library for Rust
Other
5.72k stars 425 forks source link

`juniper_actix` does not compile with the `subscription` feature enabled #1167

Closed cloudsftp closed 1 year ago

cloudsftp commented 1 year ago

I wanted to run the subscription example for actix, but could not compile the dependency juniper_actix.

This is the problem:

...
   Compiling juniper_actix v0.4.0
error[E0277]: the trait bound `SubscriptionActor<Query, Mutation, Subscription, CtxT, S, I>: actix::actor::Actor` is not satisfied
   --> /home/fabi/.cargo/registry/src/github.com-1ecc6299db9ec823/juniper_actix-0.4.0/src/lib.rs:320:80
    |
320 |         fn handle(&mut self, msg: Result<ws::Message, ws::ProtocolError>, ctx: &mut Self::Context) {
    |                                                                                ^^^^^^^^^^^^^^^^^^ the trait `actix::actor::Actor` is not implemented for `SubscriptionActor<Query, Mutation, Subscription, CtxT, S, I>`
    |
    = help: the following other types implement trait `actix::actor::Actor`:
              actix::actors::mocker::Mocker<T>
              actix::sync::SyncArbiter<A>
note: required by a bound in `WebsocketContext`
   --> /home/fabi/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-web-actors-4.2.0/src/ws.rs:460:8
    |
460 |     A: Actor<Context = WebsocketContext<A>>,
    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `WebsocketContext`

error[E0277]: the trait bound `SubscriptionActor<Query, Mutation, Subscription, CtxT, S, I>: actix::actor::Actor` is not satisfied
   --> /home/fabi/.cargo/registry/src/github.com-1ecc6299db9ec823/juniper_actix-0.4.0/src/lib.rs:358:24
    |
...

For more information about this error, try `rustc --explain E0277`.
error: could not compile `juniper_actix` due to 5 previous errors

I omitted 4 errors, but they were basically saying the same.

But when I looked into the source code, the trait Actor is implemented for SubscriptionActor: https://github.com/graphql-rust/juniper/blob/a648dd727519991c2e3c762af16eac027b2acec2/juniper_actix/src/lib.rs#LL307C1-L307C58

Could it be that the crate on crates.io is outdated? Or did I do something wrong?

Abhay478 commented 1 year ago

I'm getting the exact same problem, see this issue from last year.

PS: I'm a newbie and therefore don't really know what's going on, just trying this stuff out.

cloudsftp commented 1 year ago

Oh thanks, i did not dig deep enough.

Well then I'm going to try to compile it from source, since in that issue it says its already fixed on master but not released yet. The latest release for juniper_actix on crates.io is 2 years old.