Invalid region

I am trying to connect to cloudfare r2 bucket using s3 go sdk. But I am getting the following error: operation error S3: ListBuckets, resolve auth scheme: resolve endpoint: endpoint rule error, Invalid region: region was not a valid DNS name. Can someone please provide a solution ๐Ÿ™‚
4 Replies
Cyb3r-Jak3
Cyb3r-Jak3โ€ข13mo ago
How did your configure your client?
maneesh
maneeshOPโ€ข13mo ago
aws-sdk-go ยท Cloudflare R2 docs
You must generate an Access Key before getting started. All examples will utilize access_key_id and access_key_secret variables which represent the โ€ฆ
Cyb3r-Jak3
Cyb3r-Jak3โ€ข13mo ago
Looks like something with the AWS go sdk changed. Try using
cfg, err := config.LoadDefaultConfig(context.TODO(),
config.WithEndpointResolverWithOptions(r2Resolver),
config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(accessKeyId, accessKeySecret, "")),
config.WithRegion("auto"),
)
cfg, err := config.LoadDefaultConfig(context.TODO(),
config.WithEndpointResolverWithOptions(r2Resolver),
config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(accessKeyId, accessKeySecret, "")),
config.WithRegion("auto"),
)
maneesh
maneeshOPโ€ข13mo ago
It works! Thanks! ๐Ÿ™๐Ÿผ
Want results from more Discord servers?
Add your server