fix: improving our error messages when API keys aren't supplied#1463
Merged
Conversation
erunion
commented
May 8, 2026
|
|
||
| ## Authentication | ||
|
|
||
| For local CLI usage with a single project, you can authenticate `rdme` to your ReadMe project using `rdme login`. Once you follow the prompts and are successfully authenticated, your API key will be saved to a local configuration file (`~/.config/configstore/rdme-production.json`) and you won't have to provide the `--key` option to commands that require it. |
Member
Author
erunion
commented
May 8, 2026
| expect(result).toMatchSnapshot(); | ||
| }); | ||
|
|
||
| describe('API key validation', () => { |
Member
Author
There was a problem hiding this comment.
These tests are well covered already in lib/hooks.test.ts but I figured it would be worth having them in at least one other test to ensure that the whole flow works as intended.
erunion
commented
May 8, 2026
| return captureOutput<string>(() => Command.run(args, oclifConfig), { testNodeEnv }); | ||
| return captureOutput<string>( | ||
| async () => { | ||
| await oclifConfig.runHook('prerun', { argv: args ?? [], Command }); |
Member
Author
There was a problem hiding this comment.
Because Command.run just executes the commands executor we need to manually invoke these hooks here for our unit test command builder.
flinehan
approved these changes
May 8, 2026
flinehan
left a comment
There was a problem hiding this comment.
From my limited knowledge of this codebase these changes look good to me.
domharrington
approved these changes
May 11, 2026
erunion
pushed a commit
that referenced
this pull request
May 11, 2026
## [10.7.1-next.3](v10.7.1-next.2...v10.7.1-next.3) (2026-05-11) ### Bug Fixes * improving our error messages when API keys aren't supplied ([#1463](#1463)) ([a381af0](a381af0)) [skip ci]
Member
Author
|
🎉 This PR is included in version 10.7.1-next.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

🧰 Changes
This overhauls how our
--keyflag validation is run on each command that uses it to clean up a couple cases where you get back confusing API error messages when the API key is invalid:--key=''the error message you get back would be a hard 500 with "An unknown error has occurred.".--keyat all you'd get back a ReadMe Refactored error message of "Your project needs to be upgraded to ReadMe Refactored to make this request.".🧬 QA & Testing
No API key supplied:
When no API key is supplied and you're in a CI environment: