-
Notifications
You must be signed in to change notification settings - Fork 156
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
Improve the error message when there are no valid credentials. #2285
Comments
This seems to be even worse now. I see this when I have invalid credentials (but notably, do have
|
I opened #2858 as a tactical improvement to avoid dumping Go addresses, which should hopefully enough to remove P1 from this. Now, the experience is still not great. This is what I get after the fix:
The next step is to figure out how to:
From my brief investigation:
cc @iwahbe @t0yv0 I'm curious to get your thoughts on the above. |
Good investigation. Yes I think the duplication is certainly stemming from the split design where From what I've seen earlier, it might be a possibility to not broadcast the calls but only run Configure on sdkv2 for AWS since last time I looked PF branch used a wrapper around the same identical object representing the provider. This is not at the level of confidence though where I would recommend it right away. Thinking further, there might be an opportunity to reduce startup time if we're doing expensive Configure work twice. Deduplicating errors better is a no-brainer in terms of self rollout. |
CC @mjeffryes |
I opened pulumi/pulumi-terraform-bridge#1418 to track muxer error de-duplication in the bridge. |
Related: pulumi/pulumi-gcp#1236 |
…v format dump (#2858) A tactical improvement for #2285 to avoid Go pointers leaking into error messages. Before: > unable to validate AWS credentials. Details: [{0x14009acaee0}] Make sure you have set your AWS region, e.g. `pulumi config set aws:region us-west-2`. After: > unable to validate AWS credentials. Details: validating provider credentials: retrieving caller identity from STS: operation error STS: GetCallerIdentity, failed to resolve service endpoint, endpoint rule error, Invalid Configuration: Missing Region Make sure you have set your AWS region, e.g. `pulumi config set aws:region us-west-2`.
#2858 shipped a fix for hex addresses in the message, so I think I can remove P1 for now. We'll plan pulumi/pulumi-terraform-bridge#1418 for M96 as the next step. |
De-duplicating the errors with no valid credentials doesn't fix the issue since the errors are slightly different:
It does however fix the duplicated error message when no region is specified:
|
This should address the error duplication reported in #2285 as suggested by @t0yv0. We now have a global counter which guard the credentials check and makes sure we only run it once. For testing, I ran a few programs both with and without errors and it does seem to do the right thing. ``` Previewing update (dedev) View in Browser (Ctrl+O): https://app.pulumi.com/venelin-pulumi-corp/aws_bucket_go/dedev/previews/88831526-f63f-42f2-98d9-957fbea78fc0 Type Name Plan Info pulumi:pulumi:Stack aws_bucket_go-dedev 4 war └─ pulumi:providers:aws default 1 err Diagnostics: pulumi:providers:aws (default): error: rpc error: code = Unknown desc = unable to validate AWS credentials. Details: No valid credential sources found. Please see https://www.pulumi.com/registry/packages/aws/installation-configuration/ for more information about providing credentials. Error: failed to refresh cached credentials, failed to read cached SSO token file, open /Users/vvm/.aws/sso/cache/55357933a7310d2db90c3fa1ed0970a7bb34ed39.json: no such file or directory Make sure you have set your AWS region, e.g. `pulumi config set aws:region us-west-2`. pulumi:pulumi:Stack (aws_bucket_go-dedev): warning: using pulumi-language-go from $PATH at /opt/homebrew/bin/pulumi-language-go warning: using pulumi-resource-aws from $PATH at /Users/vvm/code/pulumi-aws/bin/pulumi-resource-aws warning: using pulumi-language-go from $PATH at /opt/homebrew/bin/pulumi-language-go warning: using pulumi-resource-aws from $PATH at /Users/vvm/code/pulumi-aws/bin/pulumi-resource-aws ```
Great job on removing duplication @VenelinMartinov ! Can you post how the error message presents with the latest changes, so we can cross-check Luke's concerns above on the message being "quite complex and awkward"? Thank you! We're very close to closing this out. |
Here is the error which shows when I delete my aws config and login cache:
#2949 should now remove all the duplication. |
The muxer previously de-duplicated `CheckFailure`s but not go errors. This PR should add that and address #1418 but not the original issue in pulumi/pulumi-aws#2285 (comment). See #1418 (comment) This fixes duplicated error messages in the aws-provider when no aws region is specified. Before: ``` error: rpc error: code = Unknown desc = 2 errors occurred: * unable to validate AWS credentials. Details: validating provider credentials: retrieving caller identity from STS: operation error STS: GetCallerIdentity, failed to resolve service endpoint, endpoint rule error, Invalid Configuration: Missing Region Make sure you have set your AWS region, e.g. `pulumi config set aws:region us-west-2`. * unable to validate AWS credentials. Details: validating provider credentials: retrieving caller identity from STS: operation error STS: GetCallerIdentity, failed to resolve service endpoint, endpoint rule error, Invalid Configuration: Missing Region Make sure you have set your AWS region, e.g. `pulumi config set aws:region us-west-2`. ``` After: ``` error: rpc error: code = Unknown desc = unable to validate AWS credentials. Details: validating provider credentials: retrieving caller identity from STS: operation error STS: GetCallerIdentity, failed to resolve service endpoint, endpoint rule error, Invalid Configuration: Missing Region Make sure you have set your AWS region, e.g. `pulumi config set aws:region us-west-2`. ```
Helps with pulumi/pulumi-aws#2285 This removes the bad error message `error: rpc error: code = Unknown desc =` and makes it more comprehensible: `pulumi:providers:aws resource 'default_6_18_2' has a problem:` The error message was this before: ``` Diagnostics: pulumi:providers:aws (default): error: rpc error: code = Unknown desc = unable to validate AWS credentials. Details: failed to get shared config profile, aws Make sure you have set your AWS region, e.g. `pulumi config set aws:region us-west-2`. ``` The distinction between an error and a failure seems to be if it was expected/unexpected IIUC. If that is true then this must be a failure instead of an error.
Similar to #1640, should help with pulumi/pulumi-aws#2285. Allow `PreConfigureCallback` to return failures in PF bridge as well as sdkv2.
Should fully address #2285 after pulumi/pulumi-terraform-bridge#1640 This makes the error messages when the user has no credentials or no region configured better and more actionable: Before, no credentials configured: ``` error: pulumi:providers:aws resource 'default_6_18_2' has a problem: could not validate provider configuration: unable to validate AWS credentials. Details: No valid credential sources found. Please see https://www.pulumi.com/registry/packages/aws/installation-configuration/ for more information about providing credentials. Error: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, request canceled, context deadline exceeded Make sure you have set your AWS region, e.g. `pulumi config set aws:region us-west-2`. ``` The line about the region is irrelevant here. After, no credentials configured: ``` Diagnostics: pulumi:providers:aws (default_6_18_2): error: pulumi:providers:aws resource 'default_6_18_2' has a problem: could not validate provider configuration: unable to validate AWS credentials. Details: No valid credential sources found. Please see https://www.pulumi.com/registry/packages/aws/installation-configuration/ for more information about providing credentials. Error: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, request canceled, context deadline exceeded ``` Before, no region configured: ``` Diagnostics: pulumi:providers:aws (default_6_18_2): error: pulumi:providers:aws resource 'default_6_18_2' has a problem: could not validate provider configuration: unable to validate AWS credentials. Details: validating provider credentials: retrieving caller identity from STS: operation error STS: GetCallerIdentity, https response error StatusCode: 0, RequestID: , request send failed, Post "https://sts..amazonaws.com/": dial tcp: lookup sts..amazonaws.com: no such host Make sure you have set your AWS region, e.g. `pulumi config set aws:region us-west-2`. ``` Here, it is not at all clear that it is the region at fault, since the note about setting the region shows up every time. After, no region configured: ``` Diagnostics: pulumi:providers:aws (default_6_18_2): error: pulumi:providers:aws resource 'default_6_18_2' has a problem: could not validate provider configuration: missing region information Make sure you have set your AWS region, e.g. `pulumi config set aws:region us-west-2`. Details: validating provider credentials: retrieving caller identity from STS: operation error STS: GetCallerIdentity, https response error StatusCode: 0, RequestID: , request send failed, Post "https://sts/..amazonaws.com/": dial tcp: lookup sts..amazonaws.com: no such host ``` The note about `config set aws:region` only shows up in this error case, so clearly actionable. For comparison, upstream, no credentials configured: ``` │ Error: configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found. │ │ Please see https://registry.terraform.io/providers/hashicorp/aws │ for more information about providing credentials. │ │ AWS Error: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, http response error StatusCode: 404, request to EC2 IMDS failed │ │ │ with provider["registry.terraform.io/hashicorp/aws"], │ on main.tf line 12, in provider "aws": │ 12: provider "aws" { │ ╵ ```
The error when there are not valid credentials is quite complex and awkward at the moment.
There are a number of opportunities to improve:
The text was updated successfully, but these errors were encountered: