`bws secret list $project_id` shouldn't return a 404 if there are no secrets in the project

Use case: I am using bws cli to programmatically update some access keys stored in a bws project. There may or may not already be keys in there so I have one path for creation and one path for update. This relies on the output of the bws secret list $project_id command; however, the command returns a 404 if there are no secrets in the project we are searching for instead of a sane “0 results found”.

Current workaround: I’ve created a dummy secret that will always exist in the project.

Preferred outcome: Only have the bws secret list $project_id command return a 404 if it can’t find the project in question. If there are no secrets, return that the project was found and that it was empty.

See error below (this was resolved upon adding a dummy secret):

Listing all secrets for the project ID to check if the key already exists...
Error: 
   0: Received error message from server: [404 Not Found] {"message":"Resource not found.","validationErrors":null,"exceptionMessage":null,"exceptionStackTrace":null,"innerExceptionMessage":null,"object":"error"}

Location:
   crates/bws/src/main.rs:472
1 Like