diff --git a/apollo-router/src/uplink/mod.rs b/apollo-router/src/uplink/mod.rs index f9afb7ce49..8f10a44c28 100644 --- a/apollo-router/src/uplink/mod.rs +++ b/apollo-router/src/uplink/mod.rs @@ -1,3 +1,4 @@ +use std::error::Error as stdError; use std::fmt::Debug; use std::time::Duration; use std::time::Instant; @@ -359,7 +360,27 @@ where Query: graphql_client::GraphQLQuery, { let client = reqwest::Client::builder().timeout(timeout).build()?; - let res = client.post(url).json(request_body).send().await?; + // It is possible that istio-proxy is re-configuring networking beneath us. If it is, we'll see an error something like this: + // level: "ERROR" + // message: "fetch failed from all endpoints" + // target: "apollo_router::router::event::schema" + // timestamp: "2023-08-01T10:40:28.831196Z" + // That's deeply confusing and very hard to debug. Let's try to help by printing out a helpful error message here + let res = client + .post(url) + .json(request_body) + .send() + .await + .map_err(|e| { + if let Some(hyper_err) = e.source() { + if let Some(os_err) = hyper_err.source() { + if os_err.to_string().contains("tcp connect error: Cannot assign requested address (os error 99)") { + tracing::warn!("If your router is executing within a kubernetes pod, this failure may be caused by istio-proxy injection. See https://github.com/apollographql/router/issues/3533 for more details about how to solve this"); + } + } + } + e + })?; tracing::debug!("uplink response {:?}", res); let response_body: graphql_client::Response = res.json().await?; Ok(response_body)