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

[BUG] Some Astra CLI command can work with DB ids, but NOT with DB names.

Open billtang-datastax opened this issue 1 year ago • 1 comments

Describe the bug Astra CLI v0.5

The following commands can only work with DB ids but not valid DB name:

  • get
  • describe
  • create-keyspace
  • list-keyspaces
  • There might be more

To Reproduce

Steps to reproduce the behavior:

  1. Generate a token with DB Admin role
  2. Config token in Astra DB CLI v0.5
  3. Run the above command with a valid DB id, make sure you can get expected results.
  4. Run the above command with the DB name
  5. The error message appear after execution failure: [ERROR] INTERNAL_ERROR: Error in HTTP Request: HttpEntity

Expected behavior If the commands work with DB id, they should work with DB name. as documented here: https://docs.datastax.com/en/astra-cli/docs/0.2/managing.html#get-database-details

Screenshots

bill.tang@Bill-Tang-DXJCJ4T4L0 ~ % astra db list -v [DEBUG] Configuration: Parsing file /Users/bill.tang/.astrarc ... [DEBUG] Configuration: [OK] Configurations are [default] [DEBUG] Configuration: Using token in section default [DEBUG] Token: AstraCS:JFvzOZjTQmzI... +---------------------+--------------------------------------+--------------+-------+---+-----------+ | Name | id | Regions | Cloud | V | Status | +---------------------+--------------------------------------+--------------+-------+---+-----------+ | first_slv_db | c7c463a8-ebda-4625-a370-b8e1343ebe32 | centralindia | azure | ■ | ACTIVE | +---------------------+--------------------------------------+--------------+-------+---+-----------+

bill.tang@Bill-Tang-DXJCJ4T4L0 ~ % astra token list
+--------------------------+--------------------------+-------------------------------------+ | Generated On | Client Id | Role | +--------------------------+--------------------------+-------------------------------------+ | 2024-02-20T04:07:52.827Z | JFvzOZjTQmzIPUTGcgSjgXLY | first_slv_db Database Administrator | +--------------------------+--------------------------+-------------------------------------+ bill.tang@Bill-Tang-DXJCJ4T4L0 ~ % astra db get c7c463a8-ebda-4625-a370-b8e1343ebe32 +------------------+-----------------------------------------+ | Attribute | Value | +------------------+-----------------------------------------+ | Name | first_slv_db | | id | c7c463a8-ebda-4625-a370-b8e1343ebe32 | | Cloud | AZURE | | Regions | centralindia | | Status | ACTIVE | | Vector | Enabled | | Default Keyspace | default_keyspace | | Creation Time | 2024-02-20T04:04:15Z | | | | | Keyspaces | [0] ks1 | | | [1] default_keyspace | | | [2] ks2 | | | | | | | | Regions | [0] centralindia | | | | +------------------+-----------------------------------------+ bill.tang@Bill-Tang-DXJCJ4T4L0 ~ % astra db get first_slv_db -v
[DEBUG] Configuration: Parsing file /Users/bill.tang/.astrarc ... [DEBUG] Configuration: [OK] Configurations are [default] [DEBUG] Configuration: Using token in section default [DEBUG] Token: AstraCS:JFvzOZjTQmzI... [ERROR] INTERNAL_ERROR: Error in HTTP Request: HttpEntity

Desktop (please complete the following information):

  • OS: [MacOS]
  • Version [14.3.1]

Additional context It'll be nice to have more details in the error message.

billtang-datastax avatar Feb 22 '24 04:02 billtang-datastax

The error came because you are using a token that is not admin and cannot do the lookup dbid->dbname i think but the error needs to be more explicit.

clun avatar Mar 08 '24 12:03 clun