Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/cue: module registry errors should show which registry was being used #3611

Open
mvdan opened this issue Dec 4, 2024 · 1 comment
Open
Labels
modules Issues related to CUE modules and the experimental implementation

Comments

@mvdan
Copy link
Member

mvdan commented Dec 4, 2024

A user on Slack just asked why they got this error when they configured a Docker credential helper for their ECR registry:

cannot put module: cannot make scratch config: 401 Unauthorized: unauthorized: bearer auth required

"bearer auth required" is an error message from the central registry at registry.cue.works, the default $CUE_REGISTRY. So the user wasn't setting $CUE_REGISTRY properly when calling cue mod publish.

The user was making a mistake here, but our error did not help either; the mistake would have been much more apparent if the error instead mentioned the registry being published to, like:

cannot put module to registry "registry.cue.works": cannot make scratch config: 401 Unauthorized: unauthorized: bearer auth required

Or, better yet, mention both the module and registry:

cannot put module "foo.com/bar" to registry "registry.cue.works": cannot make scratch config: 401 Unauthorized: unauthorized: bearer auth required

The error message at that point is getting a bit lengthy, so I suggest that we omit "cannot make scratch config", given that it's almost entirely pointless to end users:

cannot put module "foo.com/bar" to registry "registry.cue.works": 401 Unauthorized: unauthorized: bearer auth required
@mvdan mvdan added the modules Issues related to CUE modules and the experimental implementation label Dec 4, 2024
@myitcv
Copy link
Member

myitcv commented Dec 6, 2024

As a thought, if we implement cue env could we keep the error message brief? Bug reports would then be directed to include the output of cue env, much like Go does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
modules Issues related to CUE modules and the experimental implementation
Projects
Status: Backlog
Development

No branches or pull requests

2 participants