nais / nais/cli

Add better error message when user inputs invalid value for environment flag

Open
#753 0 comments 0 reactions 0 assignees View on GitHub

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 credentials should use -e dev, not -e dev-gcp
  • nais kafka grant-access should use -e dev-gcp, not -e dev
  • nais kafka list should use -e dev-gcp, not -e dev

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.