Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad Request 400 when writing from variable #204

Open
cppdecl opened this issue Jun 22, 2023 · 1 comment
Open

Bad Request 400 when writing from variable #204

cppdecl opened this issue Jun 22, 2023 · 1 comment

Comments

@cppdecl
Copy link

cppdecl commented Jun 22, 2023

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!

@offa
Copy link
Owner

offa commented Jun 23, 2023

Thanks!

I'll leave this issue open as there's some room for improvement.

Relates to #204, #181

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants