Something not quite right in the CLI tool

Since I started to use Doppler I have been using the following command in my bash scripts, with $1,$2 and $3 being the values needed to get to a valid config

doppler --project “$1” --config “$2” --token “$3” secrets get --silent --plain DOPPLER_PROJECT

This still works for all but the latest 2 configs that I have defined in a new project. When accessing these I get

Error: unknown flag: --plain

From what I can tell this is thrown as the secrets command is not being processed so the cli tool is trying to process --plain as a global flag.

Ordering the command like this

doppler secrets get --silent --plain DOPPLER_PROJECT --project “$1” --config “$2” --token “$3”

Does result in the value being returned from both my old and new configs. So there is a minor instability in the command line parser where the state/age of the config can cause the parser to miss the command to be processed unless it is the first parameter (or at least near the front of the list).

Hi @rit001!

I think something else may be going on here unrelated to the CLI. I just performed a test on my own using a script like this:

#!/usr/bin/env bash

doppler --project "$1" --config "$2" --token "$3" secrets get --silent --plain DOPPLER_PROJECT

I tried that passing in a project and config that have existed for approaching a year at this point and it worked fine. I then created a brand new project and tested it using that and it worked fine too.

Could you provide me with some additional details?

  • What shell are you using and what version?
  • What CLI version are you using?
  • If you run your script in a vanilla Ubuntu container (i.e., docker run --rm -it ubuntu bash), do you observe the same behavior?

Regards,
-Joel

Hi,

Distro Ubuntu 22.04.1 LTS
bash version 5.1.16(1)-release
doppler v3.53.1

I see the same error if I create a docker environment with 22.04 + lsb-core and docker cli

I’m running the command at the command line to remove any possible script side effects, with all the parameters expanded out to their true values.

I’m pretty sure I know what it is - my project is called “secrets” so your CLI parser is not correctly parsing parameters as it scans the list provided.

So

  • place the command ‘secrets’ at the start of the command line and the parser correctly understands that it needs to process the parameters for the secrets command.

  • place --project at the start of the command line with a parameter of “secrets” and things start to go wrong.

Ah, yep! That seems to be the issue. I was able to reproduce it when I used a project named secrets. I’ll go ahead and get an issue opened about this.

Yep it is a parser error you can try the following

doppler --project “test” --config “secrets” --token “dp.st.secr.4hq973K5p0X1HCXnIVdBTUtH20Wja5i5sz9niNPfe1d” secrets get DOPPLER_CONFIG

which goes to a test config I have just created. This throws the following error

Error: unknown command “dp.st.secr.4hq973K5p0X1HCXnIVdBTUtH20Wja5i5sz9niNPfe1d” for “doppler secrets”
Usage:
doppler secrets [flags]
doppler secrets [command]

So the --config parameter “secrets” is being parsed as the ‘secrets’ command.

I would guess that it will happen for all commands when they end up being used as parameters and the command is ordered in the way that I have done it - the only reason for that order was that it was based on an example posted by one of your team to a past question I had posted.

So there is a bug, but few people should come across it as they are more likely to follow the command line structure shown in the help text.

I actually tested another command (configs) and it didn’t trigger this behavior, so there is likely some special casing around the secrets command. We’ll look into it! Thanks for reporting this!

Edit: I take it back! It seems like the problem solely occurs when the value of the project or config parameter matches the command being run. So, you can use the secrets project or config if you’re executing doppler configs, but if you use doppler secrets it will fail to parse. Likewise, if you use configs as the project or config, doppler secrets will work, but doppler configs will not.