Only when using -type 'flux', I get an error on 1.8.0. I'm pretty sure I did not get this error on 1.7.6 .
__Steps to reproduce:__
influx -host localhost4 -port 8086 -database test -username test -password test -type 'flux'
Execute query:
from(bucket: "test"|> range(start: -10y) |> filter(fn: (r) => r._measurement == "test" and r._field == "test") |> group() |> window(every: 1mo) |> sum()
__Expected behavior:__
Data.
__Actual behavior:__
Error: 404 page not found
: 404 Not Found
tcpdump:
POST / HTTP/1.1
Host: localhost4:8086
User-Agent: Go-http-client/1.1
Content-Length: 1739
Accept: text/csv
Authorization: Basic <snip>
Content-Type: application/json
Accept-Encoding: gzip
{"spec":{"operations":[{"kind":"influxDBFrom","id":"influxDBFrom0","spec":{"bucket":"test"}},{"kind":"range","id":"range1","spec":{"start":"-87660h0m0s","stop":"now","timeColumn":"_time","startColumn":"_start","stopColumn":"_stop"}},{"kind":"filter","id":"filter2","spec":{"fn":{"fn":{"type":"FunctionExpression","block":{"type":"FunctionBlock","parameters":{"type":"FunctionParameters","list":[{"type":"FunctionParameter","key":{"type":"Identifier","name":"r"}}],"pipe":null},"body":{"type":"LogicalExpression","operator":"and","left":{"type":"BinaryExpression","operator":"==","left":{"type":"MemberExpression","object":{"type":"IdentifierExpression","name":"r"},"property":"_measurement"},"right":{"type":"StringLiteral","value":"test"}},"right":{"type":"BinaryExpression","operator":"==","left":{"type":"MemberExpression","object":{"type":"IdentifierExpression","name":"r"},"property":"_field"},"right":{"type":"StringLiteral","value":"test"}}}}}}}},{"kind":"group","id":"group3","spec":{"mode":"by","columns":[]}},{"kind":"window","id":"window4","spec":{"every":"1mo","period":"1mo","offset":"0ns","timeColumn":"_time","stopColumn":"_stop","startColumn":"_start","createEmpty":false}},{"kind":"sum","id":"sum5","spec":{"columns":["_value"]}}],"edges":[{"parent":"influxDBFrom0","child":"range1"},{"parent":"range1","child":"filter2"},{"parent":"filter2","child":"group3"},{"parent":"group3","child":"window4"},{"parent":"window4","child":"sum5"}],"resources":{"priority":"high","concurrency_quota":0,"memory_bytes_quota":0},"now":"2020-04-16T22:00:12.241138003Z"},"query":"","type":"flux","dialect":{"header":true,"delimiter":"\u0000","commentPrefix":"#","dateTimeFormat":"RFC3339","annotations":["datatype","group","default"]}}
HTTP/1.1 404 Not Found
Content-Type: text/plain; charset=utf-8
X-Content-Type-Options: nosniff
X-Influxdb-Build: OSS
X-Influxdb-Version: 1.8.0
Date: Thu, 16 Apr 2020 22:00:12 GMT
Content-Length: 19
404 page not found
__Environment info:__
Linux 5.5.15-200.fc31.x86_64 x86_64InfluxDB v1.8.0 (git: 1.8 781490de48220d7695a05c29e5a36f550a4568f5)__Config:__
Pretty default..
__Logs:__
I see no errors in the log.
@gaardiolor I'm not 100% sure this is the issue, but I do see where it could be hangin up. When using Flux to query InfluxDB 1.x, your bucket is a combination of your the database and retention policy using the following pattern: database/retention-policy. To use the default retention policy, you can just use database/.
Try updating from(bucket: 'test') to from(bucket: 'test/') or from(bucket: 'test/default').
I've tried, but I get the same error. It seems to be a quote thing.. but with doube quotes I'm getting a 404. I've checked in logs, on 1.7.6 this query (with double quotes) was working.. I'll edit the original post to reflect the new error.
So the influx client is doing the POST to / instead of /api/v2/query . If I route the requests via apache and do RewriteRule "^/$" "http://127.0.0.1:8086/api/v2/query" [P] it works.
We are seeing the same issue. Clients with Influx cli v1.7.10 work when executing a Flux query on InfluxDB v1.8.0
v1.8.0 of the Influx cli client throws a 404. Thanks to @gaardiolor we were able to figure out the problem, thanks!
Instead of the routing-through-apache, the influx command takes a path-prefix argument. When added, the query works as intended:
influx -username <username> -password <password> -type flux -host <server> -path-prefix /api/v2/query
The hint was this community article: https://community.influxdata.com/t/flux-not-working-with-influxdb-1-8/13936/3
Maybe it can save someone some time searching for a fix.
@alexdesmet perfect - that worked for me - def saved me time, appreciated it.
this worked
from(bucket:"pairs/") |> range(start: -10h)
influx -precision rfc3339 -type=flux -path-prefix /api/v2/query
my values:
influx -version
InfluxDB shell version: 1.8.1
influxd version
InfluxDB v1.8.1 (git: 1.8 af0237819ab9c5997c1c0144862dc762b9d8fc25)
about to try in the golang SDK -
I experienced the same error with influx version 1.8.3. @stuartcarnie can we get a bug label please?
Most helpful comment
We are seeing the same issue. Clients with Influx cli v1.7.10 work when executing a Flux query on InfluxDB v1.8.0
v1.8.0 of the Influx cli client throws a 404. Thanks to @gaardiolor we were able to figure out the problem, thanks!
Instead of the routing-through-apache, the influx command takes a path-prefix argument. When added, the query works as intended:
influx -username <username> -password <password> -type flux -host <server> -path-prefix /api/v2/queryThe hint was this community article: https://community.influxdata.com/t/flux-not-working-with-influxdb-1-8/13936/3
Maybe it can save someone some time searching for a fix.