Skip to content

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

Description

@bjerga

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions