influx-cli icon indicating copy to clipboard operation
influx-cli copied to clipboard

Error: failed to xxxxxxxx : 400 Bad Request: unable to decode response content type ""

Open MachEleven opened this issue 4 years ago • 5 comments

Server: ec2 instance with Ubuntu 20.04 Influxdb version: 2.1.1

Upgraded to Influxdb OSS v2.1.1 from v2.09 Then I installed influx-cli with wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-2.2.1-amd64.deb sudo dpkg -i influxdb2-client-2.2.1-amd64.deb

I have a cli config file: ~/.influxdbv2/configs : [default] url = "http://localhost:8086" token = "xxxxxxx==" org = "XXXXX" active = true

When I use commands influx influx version I get proper replies.

However using commands like influx bucket list influx dashboards influx ping influx v1 dbrp list returns Error: failed to xxxxxxxx : 400 Bad Request: unable to decode response content type ""

.

MachEleven avatar Nov 24 '21 18:11 MachEleven

I'm not able to reproduce this on an Ubuntu 20.04 ec2 instance, using a fresh install of InfluxDB OSS 2.1.1 via the .deb and running it with systemctl.

Are you able to interact with the server using curl? If influx ping results in an error, it would be interesting to see what curl -i http://localhost:8086/ping gets you. If the server is working, you should see something like:

HTTP/1.1 204 No Content
X-Influxdb-Build: OSS
X-Influxdb-Build: oss2
X-Influxdb-Version: 2.1.1
X-Influxdb-Version: 2.1.1
Date: Thu, 23 Dec 2021 19:31:50 GMT

williamhbaker avatar Dec 23 '21 19:12 williamhbaker

I'm sorry that I'm replying back so late. Using curl -i https://localhost:8086/ping command, gives me curl: (60) SSL certificate problem: self signed certificate error. As you can see, I'm using self signed certificates. When I use curl -i -k https://localhost:8086/ping to supress the error, I see a proper reply. HTTP/2 204 x-influxdb-build: OSS x-influxdb-build: oss2 x-influxdb-version: 2.1.1 x-influxdb-version: 2.1.1

After disabling the TLS, CLI started to work as intended. It would be nice to have the CLI working through TLS with self signed certificates.

MachEleven avatar Jan 07 '22 08:01 MachEleven

@MachEleven you need to set the flag --host https://localhost:8086 in your active default config you have http:// ...in the URI. Alternatively you can create a config for the https URI and set this active. However, in most cases I guess you'll need the additional --skip-verify flag when using influx CLI and a self-signed certificate.

FrenzelThomas avatar Jan 24 '22 13:01 FrenzelThomas

I am also seeing the same error message. I am running influx as a Windows service via nppm and I started seeing this message after I've enabled TLS certificate for HTTPS.

I type influx server-config -t <my-admin-token>, and I get:

influx : Error: failed to retrieve config: 400 Bad Request: unable to decode response content type ""

I run influx ping, and I get:

influx : Error: failed to retrieve config: 400 Bad Request: unable to decode response content type ""

Running influx ping -t <my-admin-token> gives me the same result as above, and running curl -i https://localhost:8086/ping is asking for uri - not sure how to handle this (this is my response after trying out some of the suggestions found in Google).

k-byun avatar Aug 19 '22 03:08 k-byun

My issue has been resolved. I had to add -host https://<url> in the influx server-config command. The use of -http-debug actually allowed me to see the actual helpful error message.

k-byun avatar Aug 19 '22 16:08 k-byun