“Error reading InfluxDB” when trying to add InfluxDB 2.0 Data Source with Flux Query Language

What happened: “Error reading InfluxDB” pop-up raised on clicking “Save and Test” when adding InfluxDB 2.0 Data Source with “Flux” Query Language. Grafana server log shows “connection refused”.

What you expected to happen: The connection test to pass without error.

How to reproduce it (as minimally and precisely as possible): Follow the Configure Grafana to use Flux guide from InfluxDB.

Anything else we need to know?: I have also tried adding an “Authorization” header with value “Token <influxdb token>” as detailed here but get the same result. I have tried using a default access token with sufficient permissions and an “All access” token to no avail. I have also tried using the org id instead of the org name. I am able to successfully execute a query manually using curl from the same machine as the Grafana server, as outlined in the Influx 2.0 API docs – so I can confirm that influx connection can be made and that the tokens are valid. I am having similar issues setting up the same source using the “InfluxQL” Query Language option, following the InfluxDB Grafana with InfluxQL guide.


  • Grafana version: v7.4.5 (8a2c78d)
  • Data source type & version: InfluxDB Flux (InfluxDB 2.0.4) running as docker container
  • OS Grafana is installed on: Debian 10, grafana running as docker container from official image
  • User OS & Browser: Debian 10, Google Chrome Version 83.0.4103.97 (Official Build) (64-bit)
  • Grafana plugins: None
  • Others: N/A

Data source config

Grafana server log

t=2021-03-23T10:51:16+0000 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=POST path=/api/ds/query status=400 remote_addr=xxx.xxx.xxx time_ms=48 size=946 referer=http://localhost:3000/datasources/edit/1/
t=2021-03-23T10:51:28+0000 lvl=warn msg="Flux query failed" logger=tsdb.influx_flux err="Post \"http://localhost:8086/api/v2/query?org=spiro\": dial tcp connect: connection refused" query=buckets()

1 possible answer(s) on ““Error reading InfluxDB” when trying to add InfluxDB 2.0 Data Source with Flux Query Language

  1. @gabor I was playing around with this earlier. You were correct about the url issue. I was using docker-compose and switching to “http://influxdb:8086” in my case worked. I was also able to set up an InfluxQL-based data source after switching to the new url. Thanks for your help.