EagleJohn81
EagleJohn81

Reputation: 11

InfluxDB v2 compatibility endpoint /query not working after mapping unmapped buckets

Creating an InfluxQL datasource in Grafana to InfluxDB 2.0 (2.0.0-beta.16) failed with error:

can't assign to property "executedQueryString" on "<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">InfluxDB 2.0<base href="/"><link rel="shortcut icon" href="/favicon.ico"><div id="react-root" data-basepath=""><script src="/5e93c5f5aa.js">": not an object

I followed the procedure to map unmapped buckets on https://docs.influxdata.com/influxdb/v2.0/query-data/influxql/#map-unmapped-buckets and tried to create the datasource in Grafana using https://docs.influxdata.com/influxdb/v2.0/tools/grafana/#configure-grafana-to-use-influxql

Using postman, I'm getting the same output when querying the InfluxDB v1 compatible endpoint:

curl --location --request GET 'http://54.226.129.163/query?db=db-35days&rp=rp-35days' \
--header 'Authorization: Token VuLd01YvgyBNnWQlzFXDgDT08DFGdfgr4et6456HzrNpHqKF4q8VvQUZrMLLoyUUpJbdSU0mwUPYISV1LdjQ==' \
--data-urlencode 'q=select * from ping'

<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>InfluxDB 2.0</title>
    <base href="/">
    <link rel="shortcut icon" href="/favicon.ico">
</head>

<body>
    <div id="react-root" data-basepath=""></div>
    <script src="/5e93c5f5aa.js"></script>
</body>

</html>

I verified the database retention policy mapping is available using:

curl --location --request GET 'http://my-influxdb/api/v2/dbrps/06868db0219ad000?org=PBC' \
--header 'Authorization: Token VuLd01YvgyBNnWQlzFXDgDT08DFGdfgr4et6456HzrNpHqKF4q8VvQUZrMLLoyUUpJbdSU0mwUPYISV1LdjQ=='


{
    "content": {
        "id": "06868db0219ad000",
        "database": "db-35days",
        "retention_policy": "rp-35days",
        "default": true,
        "organization_id": "218adfcaf421474d",
        "bucket_id": "9fd165c106e5f962"
    }
}

According the documentation on https://docs.influxdata.com/influxdb/v2.0/reference/api/influxdb-1x/dbrp/ a new database/retention-policy bucket is automatically created with a DBRP mapping, and data is written to the bucket if no matching bucket is found. I tried this as well using an "all access token", but got the same wrong response:

curl --location --request POST 'http://my-influxdb/write?db=testdb&rp=testrp' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token VuLd01YvgyBNnWQlzFXDgDT08DFGdfgr4et6456HzrNpHqKF4q8VvQUZrMLLoyUUpJbdSU0mwUPYISV1LdjQ==' \
--data-raw 'measurement,host=host1 field1=2i,field2=2.0 1577836800000000000'


<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>InfluxDB 2.0</title>
    <base href="/">
    <link rel="shortcut icon" href="/favicon.ico">
</head>

<body>
    <div id="react-root" data-basepath=""></div>
    <script src="/5e93c5f5aa.js"></script>
</body>

</html>

I can query the v2 endpoint without issues using Flux:

curl --location --request POST 'http://my-influxdb/api/v2/query?org=PBC' \
--header 'Content-Type: application/vnd.flux' \
--header 'Accept: application/csv' \
--header 'Authorization: Token VuLd01YvgyBNnWQlzFXDgDT08DFGdfgr4et6456HzrNpHqKF4q8VvQUZrMLLoyUUpJbdSU0mwUPYISV1LdjQ==' \
--data-raw 'from(bucket: "35days")
  |> range(start: -12h)
  |> filter(fn: (r) => r["_measurement"] == "ping")
  |> yield(name: "mean")'


,result,table,_start,_stop,_time,_value,_field,_measurement,account
,mean,0,2020-10-27T22:52:58.644679856Z,2020-10-28T10:52:58.644679856Z,2020-10-28T08:49:35Z,0.4,standard_deviation_ms,ping,pbc

Upvotes: 0

Views: 3673

Answers (2)

Eugene Doronin
Eugene Doronin

Reputation: 1

Still the issue for me in InfluxDB 2.0.2 I can see in log it does not read my query at all:

curl --request GET http://localhost:8086/query \
> --header "Authorization: Token <token>" \
> --data-urlencode "db=<db>" \
> --data-urlencode "rp=autogen" \
> --data-urlencode "q=SELECT * FROM <measurment>"

It's after the mapping. Here is what I can see in log

ts=2020-12-09T11:26:08.379293Z lvl=info msg="executing new query" log_id=0QwcNMnG000 query=

Upvotes: 0

EagleJohn81
EagleJohn81

Reputation: 11

Issue solved with InfluxDB v2 GA version.

Upvotes: 1

Related Questions