{"id":1197,"hash":"f019d4d27eef1371ec8434a093714a60813fc1806c87623bbc640c879923b040","pattern":"Error &quot;BlockingClientInFutureContext&quot; when trying to make a request from within an actix-web route handler function","full_message":"I am writing a web service with Rust 2018 Stable and Actix-Web. Using Reqwest, I am making an HTTP request to a diffent site from within one route handler function. Simplyfied it looks like this \n\nextern crate reqwest;\nuse actix_web;\nuse reqwest::Url;\n\npub fn testing(req: actix_web::HttpRequest) -> actix_web::Result<actix_web::HttpResponse> {\n    println!(\">>> testing request begin\");\n    let url = Url::parse(\"https://example.com/\").unwrap();\n    println!(\">>> testing url built\");\n    let req = reqwest::Client::new().post(url);\n    println!(\">>> testing req prepared\");\n    let res_struct = req.send();\n    println!(\">>> testing res_struct received\");\n    let res = res_struct.unwrap();\n    println!(\">>> testing res unwrapped\");\n    Ok(format!(\"done.\").into())\n}\n\nThat doesn't work, and I am getting the following error message (the error is printed 8 times, \"worker:1\" to \"worker:8\", despite calling the function only once):\n\nthread 'actix-rt:worker:1' panicked at 'called `Result::unwrap()` \non an `Err` value: Error(BlockingClientInFutureContext, \n\"https://www.example.com/\")', src/libcore/result.rs:999:5\nPanic in Arbiter thread, shutting down system.\n\nGoogle didn't find anything useful on \"BlockingClientInFutureContext\", but I am guessing it is somehow related to async/await or maybe Tokio's own futures? \n\nThanks for any pointers about what to read up on. Also, I am new to Rust.\n\nThe handler function is called from the Actix-Web HTttpServer:\n\nHttpServer::new(|| App::new().service(\n    web::resource(\"/testing\").route(\n        web::get().to(views::testing)\n    )\n)).bind(\"127.0.0.1:8001\")?.run()","ecosystem":"cargo","package_name":"actix-web","package_version":null,"solution":"I had a similar issue. The resolution for me was to lock the Reqwest crate version at 0.9.17 in your cargo file then rebuild.\n\nreqwest = \"=0.9.17\"\n\nIt appears that newer version of Reqwest are broken with Actix-web unless you're using the async functionality on both. For reference: https://github.com/seanmonstar/reqwest/issues/541","confidence":0.75,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/57540455/error-blockingclientinfuturecontext-when-trying-to-make-a-request-from-within","votes":4,"created_at":"2026-04-19T04:52:34.057290+00:00","updated_at":"2026-04-19T04:52:34.057290+00:00"}