@@ -17,8 +17,9 @@ import (
1717 "context"
1818 "errors"
1919 "sync"
20-
21- "github.com/aws/aws-sdk-go/aws"
20+ "github.com/aws/aws-sdk-go-v2/aws"
21+ awsv2config "github.com/aws/aws-sdk-go-v2/config"
22+ v2creds "github.com/aws/aws-sdk-go-v2/credentials"
2223 "github.com/aws/aws-sdk-go/aws/credentials"
2324 "github.com/aws/aws-sdk-go/aws/session"
2425 "github.com/aws/aws-sdk-go/service/dynamodb"
@@ -193,12 +194,31 @@ func (c *KinesisClients) WorkerCfg(ctx context.Context, stream, consumer, mode s
193194 const sharedMode = "shared"
194195 if c .Kinesis != nil {
195196 if mode == sharedMode {
197+ << << << < HEAD
196198 if c .Credentials != nil {
197199 kclConfig := config .NewKinesisClientLibConfigWithCredential (consumer ,
198200 stream , c .Region , consumer ,
199201 c .Credentials )
200202 return kclConfig
201203 }
204+ == == == =
205+ // Try v2 default config first (standard approach for v2 components)
206+ v2Config , err := awsv2config .LoadDefaultConfig (ctx , awsv2config .WithRegion (region ))
207+ if err == nil {
208+ kclConfig := config .NewKinesisClientLibConfigWithCredential (applicationName , stream , region , "" , v2Config .Credentials )
209+ return kclConfig
210+ }
211+ // Fallback to v1 credentials if v2 fails
212+ v1Creds , v1Err := c .Credentials .Get ()
213+ if v1Err != nil {
214+ // Both v2 and v1 failed, return nil
215+ return nil
216+ }
217+ // Convert v1 credentials to v2 format
218+ v2Creds := v2creds .NewStaticCredentialsProvider (v1Creds .AccessKeyID , v1Creds .SecretAccessKey , v1Creds .SessionToken )
219+ kclConfig := config .NewKinesisClientLibConfigWithCredential (applicationName , stream , region , "" , v2Creds )
220+ return kclConfig
221+ >> >> >> > 9 b9f2b98 (make the v2 creds provider be the default )
202222 }
203223 }
204224
0 commit comments