Add better error message when user inputs invalid value for environment flag
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 2
- Forks
- 5
- Avg merge
- 17m
- Merged PRs (30d)
- 11
Description
I recently started to use the Nais CLI. While trying to run nais kafka credentials -t <team> -e dev-gcp --ttl 1d, I encountered an error message:
creating Kafka credentials: input:3:2: createKafkaCredentials The server errored out while processing your request, and we didn't write a suitable error message. You might consider that a bug on our side. Please try again, and if the error persists, contact the Nais team.
The error was caused by the environment flag being set to dev-gcp instead of dev. Running nais kafka grant-access or nais kafka list, however, accepts an environment flag dev-gcp, not dev.
As an easy mistake to make (and detect?), I suggest adding error messages explaining the invalid environment flag in the following cases:
nais kafka credentialsshould use-e dev, not-e dev-gcpnais kafka grant-accessshould use-e dev-gcp, not-e devnais kafka listshould use-e dev-gcp, not-e dev
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Nais CLI implementations of kafka credentials, kafka grant-access, and kafka list, then trace how each environment flag is validated and how server errors are surfaced. Done means invalid dev/dev-gcp values produce specific guidance for the affected command instead of the generic server error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kafka
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100