newrelic / newrelic-cli

The New Relic Command Line Interface
https://developer.newrelic.com/explore-docs/newrelic-cli
Apache License 2.0
128 stars 70 forks source link

Bug/Regression: lowercase region causes fatal error in v0.6.0 #173

Closed devfreddy closed 4 years ago

devfreddy commented 4 years ago

Description

Given a pre-existing credentials.json from the nr1 cli, with profiles containing a lowercase "region": "us" version 0.5.0 executes commands successfully, version 0.6.0 throws a fatal error.

Go Version

go version go1.14 darwin/amd64

Current behavior

Throws a fatal error

Expected behavior

Should accept lowercase values from the region property in credentials.json

Steps To Reproduce

Steps to reproduce the behavior:

Utilizing v0.6.0 of the newrelic-cli...

  1. Running a command (that later succeeds), the CLI errors with:

    FATAL[2020-04-06T12:50:39-04:00] unable to create New Relic client with error: unsupported region configured

  2. I then went to create the profile, hoping it would update the region to a correct value:

    FATA[0000] profile with name fluffy-waffles already exists

  3. Edited ~/.newrelic/credentials.json and changed the region to US instead of us, and now my command works:

    INFO[2020-04-06T12:51:47-04:00] success

Debug Output (if applicable)

If applicable, add associated log output to help explain the problem.

Additional Context

@jthurman42 Verified that v0.5.0 is okay with the lowercase values in credentials.json

References or Related Issues

Are there any other related GitHub issues (open or closed) or Pull Requests that should be linked here?

zlesnr commented 4 years ago

Does this happen with just any command? I'm having trouble reproducing the issue, using what's in master branch with a lowercase region in my ~/.newrelic/credentials.json file.