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

different error-message structure in influxdb 1.8.x and 2.0.x when using InfluxQL #21173

Open
gabor opened this issue Apr 8, 2021 · 1 comment
Labels
area/compat-v1x v1.x compatibility related work in v2.x area/influxql Issues related to InfluxQL query language area/2.x OSS 2.0 related issues and PRs

Comments

@gabor
Copy link

gabor commented Apr 8, 2021

Steps to reproduce:

  1. using influxdb 1.8.4, execute an invalid query using a POST request at /query, for example the query "SOMETHING"
  2. the returned JSON will be like this:
{
    "error": "error parsing query: found SOMETHING, expected SELECT, DELETE, SHOW, CREATE, DROP, EXPLAIN, GRANT, REVOKE, ALTER, SET,
KILL at line 1, char 1"
}
  1. do the same with influxdb 2.0.4 (where the influxql-compatibility-things have been set up)
  2. the returned JSON will be like this:
{
    "code": "invalid",
    "message": "failed to parse query: found SOMETHING, expected SELECT, DELETE, SHOW, CREATE, DROP, EXPLAIN, GRANT, REVOKE, ALTER,
SET, KILL at line 1, char 1"
}
  1. the error-message structure is different between influxdb1 and influxdb2

Expected behavior:
Influx1 and Influx2 use the same error-message structure when queried in influxql-mode

Actual behavior:
Influx1 and Influx2 have different error-message structures when queried in influxql-mode

Environment info:

  • System info: docker
  • InfluxDB version: 1.8.4 and 2.0.4 in docker

Config:
default config used.

@danxmoran danxmoran added area/2.x OSS 2.0 related issues and PRs area/compat-v1x v1.x compatibility related work in v2.x area/influxql Issues related to InfluxQL query language labels Apr 9, 2021
@alaendle
Copy link

alaendle commented May 5, 2023

The same is unfortunately true for the /write endpoint. E.g. v2 returns {"code":"unprocessable entity","message":"failure writing points to database: partial write: points beyond retention policy dropped=1"} while v1 has an error element.

alaendle added a commit to alaendle/influxdb-haskell that referenced this issue May 5, 2023
Unfortunately the v1 compatibility mode of v2 doesn't work as expected in case of error messages.
See e.g. influxdata/influxdb#21173

While InfluxDV v1 always shows a `error` element int the response (see https://docs.influxdata.com/influxdb/v1.3/tools/api/), v2 also emits error messages without an `error` element (see https://docs.influxdata.com/influxdb/v2.7/api/v1-compatibility/).

E.g. v2 could return something like `{"code":"unprocessable entity","message":"failure writing points to database: partial write: points beyond retention policy dropped=1"}` - which currently leads to a `ClientError` exception just showing the message that the `error` key isn't present and the requested URL (which is pretty useless, since the original error message is swallowed.

Therefore a small change to provide a workaround for this pretty ugly situation 😅 

And for sure we all know that this is a problem of the InfluxDB - but maybe you would like to introduce this pretty small change to provide a workaround; if not, please feel free to just close this PR. 

And independently thanks for providing this library ❤️
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/compat-v1x v1.x compatibility related work in v2.x area/influxql Issues related to InfluxQL query language area/2.x OSS 2.0 related issues and PRs
Projects
None yet
Development

No branches or pull requests

3 participants