Skip to content

Commit

Permalink
Fix missing region error when using Firelens external config.
Browse files Browse the repository at this point in the history
GetBucketLocation returns null for bucket in us-east-1. Return us-east-1 instead of null in that case.
  • Loading branch information
fenxiong committed Feb 12, 2020
1 parent ee53fdb commit 2e6525c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion agent/s3/factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import (
)

const (
roundtripTimeout = 5 * time.Second
bucketLocationDefault = "us-east-1"
roundtripTimeout = 5 * time.Second
)

type S3ClientCreator interface {
Expand Down Expand Up @@ -69,6 +70,9 @@ func getRegionFromBucket(svc *s3.S3, bucket string) (string, error) {
if err != nil {
return "", err
}
if result.LocationConstraint == nil { // GetBucketLocation returns nil for bucket in us-east-1.
return bucketLocationDefault, nil
}

return aws.StringValue(result.LocationConstraint), nil
}

0 comments on commit 2e6525c

Please sign in to comment.