Fix FlightSQL queries from Grafana
When testing out the InfluxDB Grafana plugin with the v1 query API in Edge (v3), I found that when using SQL to query the target server does not work.
hyper is rejecting the request with an "invalid HTTP method" error.
You can see this error in the logs here:
2024-03-14T18:45:59.267691Z TRACE hyper::proto::h1::conn: Conn::read_head
2024-03-14T18:45:59.267793Z TRACE hyper::proto::h1::io: received 232 bytes
2024-03-14T18:45:59.268304Z TRACE parse_headers: hyper::proto::h1::role: Request.parse bytes=232
2024-03-14T18:45:59.268633Z TRACE hyper::proto::h1::conn: State::close_read()
2024-03-14T18:45:59.268659Z DEBUG hyper::proto::h1::conn: parse error (invalid HTTP method parsed) with 232 bytes
2024-03-14T18:45:59.268743Z DEBUG hyper::proto::h1::role: sending automatic response (400 Bad Request) for parse error
2024-03-14T18:45:59.268989Z TRACE encode_headers: hyper::proto::h1::role: Server::encode status=400, body=None, req_method=None
2024-03-14T18:45:59.269576Z DEBUG hyper::proto::h1::io: flushed 84 bytes
2024-03-14T18:45:59.269609Z TRACE hyper::proto::h1::conn: flushed({role=server}): State { reading: Closed, writing: Closed, keep_alive: Disabled, error: hyper::Error(Parse(Method)) }
2024-03-14T18:45:59.269653Z TRACE hyper::proto::h1::conn: shut down IO complete
2024-03-14T18:45:59.269724Z DEBUG hyper::server::server::new_svc: connection error: invalid HTTP method parsed
The issue appears to be that Grafana is attempting a TLS handshake when establishing the connection, and because I am running my influxdb3 server locally, I am not serving TLS.
This is the error showing in Grafana:
ERROR: flightsql: rpc error: code = Unavailable desc = connection error: desc = "transport: authentication handshake failed: tls: first record does not look like a TLS handshake"
I attempted to disable all manner of TLS in my local Grafana, to no avail.
As it turns out, there was recently an issue opened for this very thing, and a PR that closes it. So, once that is released, we can try this out again with TLS properly disabled.
I'm using the latest version and I have the same issue here, is there any solution ?
Hey @m0kr4n3!
I'm using the latest version [...]
To be clear, do you mean that you are using the latest version of influxdb of latest version of Grafana?
In either case, can you verify the version of influxdb that you are using? This issue is specifically for the v3 version of influxdb that is still under development, so I just want to make sure that you aren't using a previous major version, e.g., v1.x or v2.x.
It looks like the change to allow insecure gRPC connections from Grafana's InfluxDB plugin will be part of the 11.0.0 release, which is still in preview. Unless you are willing to try out the 11.0.0-preview version of Grafana, you will need to wait for its official release.
I'm using grafana/grafana:11.0.0 with docker compose to test it. The problem seems to still exist.
Is there anyone else like that?
Hello,
I solved the problem by updating to the latest version of Grafana ( grafana/grafana:11.0.0-preview ) as yours, and building InfluxDB V3 from the base repository. Here is the configuration of the data source that I'm using:
and here's the result:
Note: It is necessary to create a database first for it to work.
Thanks to @hiltontj for the help, I appreciate it.
Glad you got it to work @m0kr4n3 - thanks for verifying!
@hipibo - I think the key, as @m0kr4n3 pointed out, is to add the insecureGrpc: true to the datasource configuration for your InfluxDB plugin. That configuration was the feature added in the PR that is part of the 11.0.0 release. Sorry that I didn't make that clear... only upgrading to 11.0.0 without adding the configuration won't resolve the issue.
I plan to leave this open until I get time to verify that it works on the stable 11.0.0 version of Grafana.
After downloading the latest version of Grafana on MacOS (11.3.0), I was able to configure the InfluxDB datasource to allow for a SQL connection to work. See this screenshot of the configuration I am using, to point at a local running InfluxDB (commit SHA used was 814eb31309d9e85c4363ad3d29a90424abfba579 ):
I will close this issue out for now.