br icon indicating copy to clipboard operation
br copied to clipboard

enable CredentialsChainVerboseErrors

Open july2993 opened this issue 5 years ago • 1 comments

Feature Request

Is your feature request related to a problem? Please describe:

hard to know they failed to get credentials from providers.

[2020/12/08 02:36:22.475 +00:00] [ERROR] [main.go:83] ["tidb lightning encountered error stack info"] [error="NoCredentialProviders: no valid providers in chain. Deprecated.\n\tFor verbose messaging see aws.Config.CredentialsChainVerboseErrors"] [errorVerbose="NoCredentialProviders: no valid providers in chain. Deprecated.\n\tFor verbose messaging see aws.Config.CredentialsChainVerboseErrors\ngithub.com/pingcap/errors.AddStack\n\t/home/jenkins/agent/workspace/ld_lightning_multi_branch_v4.0.8/go/pkg/mod/github.com/pingcap/[email protected]/errors.go:174\ngithub.com/pingcap/errors.Trace\n\t/home/jenkins/agent/workspace/ld_lightning_multi_branch_v4.0.8/go/pkg/mod/github.com/pingcap/[email protected]/juju_adaptor.go:15\ngithub.com/pingcap/tidb-lightning/lightning.(*Lightning).run\n\t/home/jenkins/agent/workspace/ld_lightning_multi_branch_v4.0.8/go/src/github.com/pingcap/tidb-lightning/lightning/lightning.go:249\ngithub.com/pingcap/tidb-lightning/lightning.(*Lightning).RunOnce\n\t/home/jenkins/agent/workspace/ld_lightning_multi_branch_v4.0.8/go/src/github.com/pingcap/tidb-lightning/lightning/lightning.go:185\nmain.main\n\t/home/jenkins/agent/workspace/ld_lightning_multi_branch_v4.0.8/go/src/github.com/pingcap/tidb-lightning/cmd/tidb-lightning/main.go:80\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:203\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1357"]
[2020/12/08 02:36:22.475 +00:00] [ERROR] [main.go:84] ["tidb lightning encountered error"] [error="NoCredentialProviders: no valid providers in chain. Deprecated.\n\tFor verbose messaging see aws.Config.CredentialsChainVerboseErrors"]

from vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go we always just get a "no valid providers in chain", but can't know the error from Provider.Retrieve for getting the creds.

// Retrieve returns the credentials value or error if no provider returned
// without error.
//
// If a provider is found it will be cached and any calls to IsExpired()
// will return the expired state of the cached provider.
func (c *ChainProvider) Retrieve() (Value, error) {
    var errs []error
    for _, p := range c.Providers {
        creds, err := p.Retrieve()
        if err == nil {
            c.curr = p
            return creds, nil
        }
        errs = append(errs, err)
    }
    c.curr = nil

    var err error
    err = ErrNoValidProvidersFoundInChain
    if c.VerboseErrors {
        err = awserr.NewBatchError("NoCredentialProviders", "no valid providers in chain", errs)
    }
    return Value{}, err
}

Describe the feature you'd like:

enable CredentialsChainVerboseErrors

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Optimization:

july2993 avatar Dec 08 '20 03:12 july2993

the s3 feature is provided by br. transferring the issue.

kennytm avatar Dec 08 '20 06:12 kennytm