Getting "connection error: builder error: failed to parse header value" from Query()
capveg-netdebug opened this issue · 0 comments
capveg-netdebug commented
Nothing matching this error in the issues that I've seen.
- Rust Version:
stable-x86_64-unknown-linux-gnu (default)
rustc 1.74.0 (79e9716c9 2023-11-13) - Runtime version (e.g. Tokio):
tokio = { version = "1.29.1", features = ["full"] } - OS Version:
Ubuntu 22.04
Steps to Reproduce:
Very basic hello world but using .with_token()
. Any idea what this could be? This is presumably coming from influxdb/src/client/mod.rs:264 but it's really unclear what to look at next or even where the error is coming from.
Any help would be appreciated! Thank you in advance.
use log::warn;
#[derive(InfluxDbWriteable)]
struct TimeSeriesDesktopCounter {
time: DateTime<Utc>,
source: String,
counter: String,
value: u64,
}
#[tokio::main]
fn main() {
const TIMESERIESDB_URL: &str = "https://XXXXX.cloudhosted-by-influx.cloud2.influxdata.com";
const API_TOKEN_FILE: &str = ".influxdb_api_token";
const TIMESERIESDB_NAME: &str = "desktop-counters";
let client = Client::new(TIMESERIESDB_URL, TIMESERIESDB_NAME);
let token = std::fs::read_to_string(".influx_api_token).unwrap_or_else(|e| {
panic!("Critical auth token {} missing:: {}", ".influx_api_token, e)
});
let client = client.with_token(token);
let queries = &[("foo", 1), ("bar", 2), ("baz", 3)]
.iter()
.map(|(c, v)| {
TimeSeriesDesktopCounter {
time: Utc::now(),
source: "test".to_string(),
counter: c.to_string(),
value: *v,
}
.into_query("test_measurement")
})
.collect::<Vec<influxdb::WriteQuery>>();
match client.query(queries).await {
Ok(out) => warn!("Returned Ok() but got string {}", out),
Err(e) => warn!("Error writing to client: {}", e),
}
}
Produces:
running 1 test
Client = Client { url: "https://XXX.influxdata.com", parameters: {"db": "desktop-counters"}, .. }
Error writing to client: connection error: builder error: failed to parse header value
test desktop_websocket::test::test_cloud_timeseries_db_store ... ok```