diff --git a/src/checkers/periodicAwsChecker.go b/src/checkers/periodicAwsChecker.go index 9a922a1..bc57ffa 100644 --- a/src/checkers/periodicAwsChecker.go +++ b/src/checkers/periodicAwsChecker.go @@ -43,7 +43,15 @@ func (p *PeriodicAwsChecker) StartChecking() { p.exporter.ResetMetrics() // Create a Session with a custom region - svc := secretsmanager.New(session.New(), aws.NewConfig().WithRegion(p.awsRegion)) + session, err := session.NewSession() + + if err != nil { + glog.Error("Error initializing AWS session: ", err) + metrics.ErrorTotal.Inc() + continue + } + + svc := secretsmanager.New(session, aws.NewConfig().WithRegion(p.awsRegion)) for _, secretName := range p.awsSecrets { glog.Info("Getting secret " + secretName + " from AWS Secrets Manager")