Skip to content

DeserializationError on "SHOW DATABASES" using non-admin credentials #74

Closed
@JEnoch

Description

@JEnoch
  • Rust Version: 1.50.0
  • Runtime version (e.g. Tokio): InfluxDB 1.8.3
  • OS Version: MacOS 10.15

Steps to Reproduce:

  1. Start a fresh InfluxDB with credentials for an admin and a non-admin user. For instance:
docker run -e INFLUXDB_HTTP_AUTH_ENABLED=true -e INFLUXDB_USER=foo -e INFLUXDB_USER_PASSWORD=bar -e INFLUXDB_ADMIN_USER=admin -e INFLUXDB_ADMIN_PASSWORD=password -p 8086:8086 influxdb:1.8
  1. Run the query "SHOW DATABASES" using the Serde integration and the non-admin credentials. For instance:
use influxdb::Client;
use serde::Deserialize;

#[tokio::main]
async fn main() -> Result<(), influxdb::Error> {
    let client = Client::new("http://localhost:8086", "unused").with_auth("foo", "bar");

    #[derive(Deserialize)]
    struct Database {
        name: String,
    }

    let read_query = influxdb::Query::raw_read_query("SHOW DATABASES");
    let mut result = client.json_query(read_query).await?;
    for db in &result.deserialize_next::<Database>()?.series[0].values {
        println!("{}", db.name);
    }
    Ok(())
}

Result:

Error: DeserializationError { error: "could not deserialize: missing field `values`" }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions