Skip to content

Bad Request 400 when writing from variable #204

Open
@cppdecl

Description

@cppdecl

For some reason, writing to influx by passing a variable as param to addField causes "Bad Request 400" error. I already attempted to use std::move the variables into the param but nothing seems to work apart from directly placing the values.

try 
{
    uint32_t online = 0;
    uint32_t cached = 0;

    influx->write(Point{"global_player_count"}
        .addField("online", online)
        .addField("cached", cached)
    );
}
catch (InfluxDBException &e)
{
    std::cout << e.what() << "\n";
}

EDIT: Finally solved it. After some digging realized how the Point::FieldValue variant does not take uint32_t as a type. A simple cast to unsigned int fixed it. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions