influxdata / influx-cli

CLI for managing resources in InfluxDB v2
MIT License
61 stars 23 forks source link

unable to delete a secret - 405 Method Not Allowed: #468

Closed andrewbierbaum closed 1 year ago

andrewbierbaum commented 1 year ago

Steps to reproduce:

  1. update and then attempt delete the a secret
    18:06 andrewbierbaum@host:~$ sudo influx secret update -k testing -v asdf
    Key Organization ID
    testing 335d31413785462f
    18:06 andrewbierbaum@host:~$ sudo influx secret delete -k testing
    Error: failed to delete secret with key "testing": 405 Method Not Allowed:

Expected behavior: the key should delete with the same credentials as it should create with

Actual behavior: it returns 405 Method Not Allowed:

Environment info:

Config:

18:19 andrewbierbaum@host:~$ sudo cat /root/.influxdbv2/configs
[default]
  url = "http://localhost:8086"
  token = "REDACTED"
  org = "REDACTED"
  active = true
FernandoBenayas commented 1 year ago

Hey! I've been suffering from this behavior as well, and I belive I've identified the source of the issue:

  1. InfluxDB's API was updated (quite some time ago, actually), and now it expects DELETE queries at /api/v2/orgs/{org id}/secrets/{secret key} instead of POST queries at /api/v2/orgs/{org id}/secrets/delete...
  2. ... but the InfluxDB client has not been updated yet, and it still sends POST queries to /api/v2/orgs/{org id}/secrets/delete when the "secret delete" command is executed

I'm working on a fix for it (I've already finished developing it, and right now I'm doing some testing - as soon as it is ready I will create a PR for it)

I believe this issue should be opened in the influx-cli repo though, not the influxdb repo

jeffreyssmith2nd commented 1 year ago

Hey @FernandoBenayas, thanks for tracking this down. I am going to move this to the influx-cli repo as I agree that's a better place for it.

FernandoBenayas commented 1 year ago

Hey @jeffreyssmith2nd thank you for transferring the issue! Just created the PR