Skip to content

Commit 57c3c41

Browse files
committed
aws: fixed S3-compatible services base endpoint
AWS SDK v2 documentation states that for S3, the BaseEndpoint should be set at the client level for proper endpoint resolution https://docs.aws.amazon.com/sdk-for-go/v2/developer-guide/configure-endpoints.html Fixes #3864
1 parent d41265d commit 57c3c41

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

internal/impl/aws/cache_s3.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ func newS3CacheFromConfig(conf *service.ParsedConfig) (*s3Cache, error) {
9393

9494
client := s3.NewFromConfig(sess, func(o *s3.Options) {
9595
o.UsePathStyle = forcePathStyleURLs
96+
97+
// For S3-compatible services, set BaseEndpoint at the client level
98+
if sess.BaseEndpoint != nil {
99+
o.BaseEndpoint = sess.BaseEndpoint
100+
}
96101
})
97102

98103
backOff, err := conf.FieldBackOff("retries")

internal/impl/aws/input_s3.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,11 @@ func (a *awsS3Reader) Connect(ctx context.Context) error {
715715

716716
a.s3 = s3.NewFromConfig(a.awsConf, func(o *s3.Options) {
717717
o.UsePathStyle = a.conf.ForcePathStyleURLs
718+
719+
// For S3-compatible services, set BaseEndpoint at the client level
720+
if a.awsConf.BaseEndpoint != nil {
721+
o.BaseEndpoint = a.awsConf.BaseEndpoint
722+
}
718723
})
719724
if a.conf.SQS.URL != "" {
720725
sqsConf := a.awsConf.Copy()

internal/impl/aws/output_s3.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,11 @@ func (a *amazonS3Writer) Connect(context.Context) error {
366366

367367
client := s3.NewFromConfig(a.conf.aconf, func(o *s3.Options) {
368368
o.UsePathStyle = a.conf.UsePathStyle
369+
370+
// For S3-compatible services, set BaseEndpoint at the client level
371+
if a.conf.aconf.BaseEndpoint != nil {
372+
o.BaseEndpoint = a.conf.aconf.BaseEndpoint
373+
}
369374
})
370375
a.uploader = manager.NewUploader(client)
371376
return nil

0 commit comments

Comments
 (0)