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

internal/registry: Add URL to error message for clarity #29298

Merged
merged 1 commit into from Aug 10, 2021

Conversation

radeksimko
Copy link
Member

Prior to this patch the user could receive a message like this from init:

Error: Failed to install provider
Error while installing 1password/onepassword v1.1.2: could not query provider
registry for registry.terraform.io/1password/onepassword: failed to retrieve
authentication checksums for provider: the request failed after 2 attempts,
please try again later: 500

While the status code is helpful, it would be far more helpful if the user knew what URL/hostname returned that error.

I mistakenly thought this would come from the Registry API, but @bethanyr helpfully pointed out to me that the checksums are in fact pulled from GitHub.

The new (proposed) error message would therefore indicate this:

Error: Failed to install provider
Error while installing 1password/onepassword v1.1.2: could not query provider
registry for registry.terraform.io/1password/onepassword: failed to retrieve
authentication checksums for provider: the request failed after 2 attempts,
please try again later: 500 Internal Server Error (https://github.com/1Password/terraform-provider-onepassword/releases/download/v1.1.2/terraform-provider-onepassword_1.1.2_SHA256SUMS)

I am also open to shortening this to just the hostname (github.com in this case) instead of full URL if we deem that whole URL makes the message too long.

Copy link
Member

@alisdair alisdair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable to me. Have you been able to verify what it looks like when there is such a failure? Does the UI really fail to wrap the error message?

@radeksimko
Copy link
Member Author

radeksimko commented Aug 10, 2021

I added some custom transports (locally) to simulate 500 and try this out which made realize that the place where I was fixing this was just responsible for the initial provider discovery, but the same client is apparently not responsible for downloading the checksums. I'm unsure what the reason is for the duplication, but I patched both places now.

Here is a screenshot from my testing

Screenshot 2021-08-10 at 10 44 13

It's not amazing but I feel that the value of that message is greater with a full URL and this probably matters more?

@radeksimko radeksimko force-pushed the f-registry-client-add-url-to-err branch 2 times, most recently from 4bdb93e to cebb838 Compare August 10, 2021 09:51
@radeksimko radeksimko force-pushed the f-registry-client-add-url-to-err branch from cebb838 to 4e20de9 Compare August 10, 2021 09:52
Copy link
Member

@alisdair alisdair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this! Those screenshots look as good as we can hope for, and I agree that the URL will be helpful for debugging.

@radeksimko radeksimko merged commit 2496bc2 into main Aug 10, 2021
@radeksimko radeksimko deleted the f-registry-client-add-url-to-err branch August 10, 2021 14:20
@radeksimko
Copy link
Member Author

@alisdair would you like me to add this to the Changelog, or is it such a minor change for most users (which only ever hit the happy path) that it's not worth mentioning? If so - which Changelog (1.1.0 / 1.0.x)?

Relatedly - what's your policy on backports? I'm okay with not backporting this FWIW, although it's minor enough that it may be low effort to backport? 🤷🏻‍♂️

@alisdair
Copy link
Member

I'd also skip the changelog, personally. It's not fixing a known issue, and it's not something anyone needs to be aware of in order to adjust their workflow.

Our policy for backports is loosely that only fixes for known issues or other critical changes go into patch releases. This doesn't seem like it's either of those, so I'd leave it on main for release with 1.1.0.

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants