Skip to content
\n

Here are my errors

\n
error: future cannot be sent between threads safely\n  --> src/main.rs:75:1\n   |\n75 | #[graphql_object(context = Context)]\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`\n   |\n   = help: within `[async block@src/main.rs:75:1: 75:37]`, the trait `std::marker::Send` is not implemented for `Rc<(dyn actix_web::dev::Service<ConnectRequest, Error = SendRequestError, Response = ConnectResponse, Future = Pin<Box<(dyn futures_util::Future<Output = Result<ConnectResponse, SendRequestError>> + 'static)>>> + 'static)>`\nnote: future is not `Send` as this value is used across an await\n  --> src/handlers/user_handlers/jeeves.rs:56:24\n   |\n51 |         let client = awc::Client::default()\n   |             ------ has type `ClientRequest` which is not `Send`\n...\n56 |         request(client).await;\n   |                        ^^^^^^ await occurs here, with `client` maybe used later\n...\n60 |       }\n   |       - `client` is later dropped here\n   = note: required for the cast from `[async block@src/main.rs:75:1: 75:37]` to the object type `dyn futures_util::Future<Output = Result<juniper::Value<__S>, FieldError<__S>>> + std::marker::Send`\n   = note: this error originates in the attribute macro `graphql_object` (in Nightly builds, run with -Z macro-backtrace for more info)\n\nerror: future cannot be sent between threads safely\n  --> src/main.rs:75:1\n   |\n75 | #[graphql_object(context = Context)]\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`\n   |\n   = help: within `[async block@src/main.rs:75:1: 75:37]`, the trait `std::marker::Send` is not implemented for `Rc<HeaderMap>`\nnote: future is not `Send` as this value is used across an await\n  --> src/handlers/user_handlers/jeeves.rs:56:24\n   |\n51 |         let client = awc::Client::default()\n   |             ------ has type `ClientRequest` which is not `Send`\n...\n56 |         request(client).await;\n   |                        ^^^^^^ await occurs here, with `client` maybe used later\n...\n60 |       }\n   |       - `client` is later dropped here\n   = note: required for the cast from `[async block@src/main.rs:75:1: 75:37]` to the object type `dyn futures_util::Future<Output = Result<juniper::Value<__S>, FieldError<__S>>> + std::marker::Send`\n   = note: this error originates in the attribute macro `graphql_object` (in Nightly builds, run with -Z macro-backtrace for more info)\n\nerror: future cannot be sent between threads safely\n  --> src/main.rs:75:1\n   |\n75 | #[graphql_object(context = Context)]\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`\n   |\n   = help: the trait `std::marker::Send` is not implemented for `(dyn futures_util::Future<Output = Result<ConnectResponse, SendRequestError>> + 'static)`\nnote: future is not `Send` as it awaits another future which is not `Send`\n  --> src/handlers/user_handlers/jeeves.rs:17:8\n   |\n17 |   dbg!(client.send_json(&json!(\"{'test': 'test'}\")).await.unwrap());\n   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `SendClientRequest`, which is not `Send`\n   = note: required for the cast from `[async block@src/main.rs:75:1: 75:37]` to the object type `dyn futures_util::Future<Output = Result<juniper::Value<__S>, FieldError<__S>>> + std::marker::Send`\n   = note: this error originates in the attribute macro `graphql_object` (in Nightly builds, run with -Z macro-backtrace for more info)\n\nerror: future cannot be sent between threads safely\n  --> src/main.rs:75:1\n   |\n75 | #[graphql_object(context = Context)]\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`\n   |\n   = help: the trait `std::marker::Send` is not implemented for `(dyn StdError + 'static)`\nnote: future is not `Send` as it awaits another future which is not `Send`\n  --> src/handlers/user_handlers/jeeves.rs:17:8\n   |\n17 |   dbg!(client.send_json(&json!(\"{'test': 'test'}\")).await.unwrap());\n   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `SendClientRequest`, which is not `Send`\n   = note: required for the cast from `[async block@src/main.rs:75:1: 75:37]` to the object type `dyn futures_util::Future<Output = Result<juniper::Value<__S>, FieldError<__S>>> + std::marker::Send`\n   = note: this error originates in the attribute macro `graphql_object` (in Nightly builds, run with -Z macro-backtrace for more info)\n\nerror: future cannot be sent between threads safely\n  --> src/main.rs:75:1\n   |\n75 | #[graphql_object(context = Context)]\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`\n   |\n   = help: the trait `std::marker::Send` is not implemented for `(dyn std::fmt::Debug + 'static)`\nnote: future is not `Send` as it awaits another future which is not `Send`\n  --> src/handlers/user_handlers/jeeves.rs:17:8\n   |\n17 |   dbg!(client.send_json(&json!(\"{'test': 'test'}\")).await.unwrap());\n   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `SendClientRequest`, which is not `Send`\n   = note: required for the cast from `[async block@src/main.rs:75:1: 75:37]` to the object type `dyn futures_util::Future<Output = Result<juniper::Value<__S>, FieldError<__S>>> + std::marker::Send`\n   = note: this error originates in the attribute macro `graphql_object` (in Nightly builds, run with -Z macro-backtrace for more info)\n
","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"

Duplicate of #1128 (comment)

","upvoteCount":1,"url":"https://github.com/graphql-rust/juniper/discussions/1144#discussioncomment-5034912"}}}
Discussion options

You must be logged in to vote

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ilslv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants