I am trying to light up a gRPC connection to my Chirpstack server. My server (https://chirp.wht1.au) works, and I have a device connected through a RAK gateway which is logging data.
I am hosting on Ubuntu via systemd.
I am writing some Rust code to try and manage devices via gRPC.
pub async fn list_devices() -> Result<(),ApiError> {
let channel = tonic::transport::Channel::from_static("https://chirp.wht1.au")
.connect()
.await?;
let token: MetadataValue<_> = "Bearer eyJ0e<hidden!>QbNfS_4U".parse()?;
let mut client = DeviceServiceClient::with_interceptor(channel, move |mut req: Request<()>| {
req.metadata_mut().insert("authorization", token.clone());
Ok(req)
});
let list_device_request = tonic::Request::new(chirpstack_api::api::ListDevicesRequest {
limit: 0,
offset: 0,
search: "".to_string(),
application_id: "4b2d02a7-<hidden>0fc".to_string(),
multicast_group_id: "".to_string(),
});
let result = client.list(list_device_request).await?;
println!("RESPONSE={:?}", result);
Ok(())
}
// test
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test]
async fn test_list_devices() {
list_devices().await.unwrap();
}
}
I am getting the following response:
called `Result::unwrap()` on an `Err` value: ApiError(status: Internal, message: "protocol error: received message with invalid compression flag: 52 (valid flags are 0 and 1) while receiving response with status: 404 Not Found", details: [], metadata: MetadataMap { headers: {"content-type": "text/plain; charset=utf-8", "x-content-type-options": "nosniff", "content-length": "19", "date": "Sun, 05 May 2024 22:05:37 GMT"} }
I’ve tried other calls, but I get 404 for all of them.
Any suggestions?