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

[Muxer] De-duplicate identical error messages in CheckConfigure #1418

Closed
iwahbe opened this issue Oct 6, 2023 · 2 comments
Closed

[Muxer] De-duplicate identical error messages in CheckConfigure #1418

iwahbe opened this issue Oct 6, 2023 · 2 comments
Assignees
Labels
kind/enhancement Improvements or new features resolution/fixed This issue was fixed

Comments

@iwahbe
Copy link
Member

iwahbe commented Oct 6, 2023

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

The muxer de-duplicates identical CheckConfig's plugin.CheckFailure, but doesn't do anything with pure go errors. It should compare the error messages reflect.Equal or err1.Error() == err2.Error() and discard one error if they are the same. This avoids duplicate errors showing up in muxed providers.

See pulumi/pulumi-aws#2285 (comment) for details.

Affected area/feature

@iwahbe iwahbe added needs-triage Needs attention from the triage team kind/enhancement Improvements or new features and removed needs-triage Needs attention from the triage team labels Oct 6, 2023
@mikhailshilkov mikhailshilkov added this to the 0.96 milestone Oct 9, 2023
@mikhailshilkov mikhailshilkov removed this from the 0.96 milestone Oct 23, 2023
@VenelinMartinov
Copy link
Contributor

VenelinMartinov commented Oct 30, 2023

Edit:

There seem to be two related issues here. De-duplicating the error messages does fix the issue of duplicate errors when no aws region is set but some of the errors are almost but not quite identical, like the one above.

Original:

Is there some other failure case which triggers identical errors? (Edit: there is, a missing aws region does cause identical errors.) With pulumi/pulumi-aws#2285 (comment) the errors raised are not actually identical. The RequestIDs are different:

Errors: {
               &errors.errorString{s:"unable to validate AWS credentials. \nDetails: No valid credential sources found. Please see https://www.pulumi.com/registry/packages/aws/installation-configuration/\nfor more information about providing credentials.\n\nError: failed to refresh cached credentials, refresh cached SSO token failed, unable to refresh SSO token, operation error SSO OIDC: CreateToken, https response error StatusCode: 400, RequestID: 3c6b0f80-596c-4afb-aed3-5075972c86d7, InvalidGrantException: \n\nMake sure you have set your AWS region, e.g. `pulumi config set aws:region us-west-2`. \n"},
               &errors.errorString{s:"unable to validate AWS credentials. \nDetails: No valid credential sources found. Please see https://www.pulumi.com/registry/packages/aws/installation-configuration/\nfor more information about providing credentials.\n\nError: failed to refresh cached credentials, refresh cached SSO token failed, unable to refresh SSO token, operation error SSO OIDC: CreateToken, https response error StatusCode: 400, RequestID: d410e929-950d-4eeb-ad5e-2c2903e0fc9a, InvalidGrantException: \n\nMake sure you have set your AWS region, e.g. `pulumi config set aws:region us-west-2`. \n"},
           }

After deleting my credentials cache I am still getting two slightly different errors:

    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`.

    	* 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, access disabled to EC2 IMDS via client option, or "AWS_EC2_METADATA_DISABLED" environment variable

    Make sure you have set your AWS region, e.g. `pulumi config set aws:region us-west-2`.

VenelinMartinov added a commit that referenced this issue Nov 16, 2023
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`.
```
@mikhailshilkov mikhailshilkov added the resolution/fixed This issue was fixed label Nov 29, 2023
@t0yv0
Copy link
Member

t0yv0 commented Jan 2, 2024

pulumi/pulumi-gcp#129 related still open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

4 participants