External InfluxDB bucket is not accessible due to 405

Hello All - I’ve been messing with this quite a bit and could use any help. I’m facing the following error message in my HA logs when trying to connect to an external influxdb instance (on my network):

(slightly trimmed for readability)

2022-10-15 19:20:32.212 ERROR (SyncWorker_7) [homeassistant.components.influxdb] InfluxDB bucket is not accessible due to '(405)
Reason: Not Allowed
HTTP response headers: HTTPHeaderDict({‘Date’: ‘Sun, 16 Oct 2022 02:20:32 GMT’, ‘Content-Type’: ‘text/html’, ‘Content-Length’: ‘150’, ‘Connection’: ‘keep-alive’, ‘Keep-Alive’: ‘timeout=20’})
HTTP response body:

405 Not Allowed Please check that the bucket, org and token are correct and that the token has the correct permissions set. Retrying in 60 seconds.

I have (obviously) tried the bucket & token using influx-cli and also just curl with -H “Authorization: Token xxxxx”. While I couldn’t figure what exactly is the API called by HA, I was able to authenticate with the same token I put in HA and do various things. To try to troubleshoot I am even using administrator token now, still no dice.

My configuration file is like such:

influxdb:
  api_version: 2
  ssl: true
  host: influx.domain
  token: !secret influx
  organization: c181853(truncated)
  bucket: homeassistant
  include:
    domains:
      - sensor
      - binary_sensor

The only additional thought I have now is maybe I just go back to an InfluxDB version 1. Maybe version 2 isn’t well supported yet? I saw also the following Git issue with influx, not sure if it might be at play here with HA:

I have the same error. Have you found a solution yet?

I ran into this exact issue today. I noticed that Home Assistant wasn’t connecting to influxdb. Turns out the port is mandatory for API v2. In my case, it was connecting to something else which happened to return the exact same error.

So I simply had to configure the default port next to the host:

  port: 8086
1 Like