C
C#15mo ago
Scottek utek

❔ AmazonS3Client problems

Greetings, I am using DigitalOcean spaces and I have been trying to use it with my backend, but there is a problem with listing all buckets, I've written this piece of code in my test app:
Environment.SetEnvironmentVariable("AWS_ACCESS_KEY_ID", "something");
Environment.SetEnvironmentVariable("AWS_SECRET_ACCESS_KEY", "something beautiful");

const string url = "I am not going to tell u my url";

AmazonS3Config config = new AmazonS3Config() { ServiceURL = url };
IAmazonS3 s3Client = new AmazonS3Client(config);

var response = await s3Client.ListBucketsAsync();
foreach (var item in response.Buckets)
Console.WriteLine(item.BucketName);
Environment.SetEnvironmentVariable("AWS_ACCESS_KEY_ID", "something");
Environment.SetEnvironmentVariable("AWS_SECRET_ACCESS_KEY", "something beautiful");

const string url = "I am not going to tell u my url";

AmazonS3Config config = new AmazonS3Config() { ServiceURL = url };
IAmazonS3 s3Client = new AmazonS3Client(config);

var response = await s3Client.ListBucketsAsync();
foreach (var item in response.Buckets)
Console.WriteLine(item.BucketName);
But after calling ListBucketsAsync, response.Buckets is just empty, which is nonsense (as you can see on the picture bellow). Any idea why this happens?
4 Replies
Scottek utek
Scottek utek15mo ago
key id, access key & url are 100% correct
Henkypenky
Henkypenky15mo ago
did u try it through postman for example? also a detailed step by step with breakpoints to see everything is correct as you say
Scottek utek
Scottek utek15mo ago
yes I even copied this piece of code and ran it in testapp I did, as I say, it's just empty but everything seems right, just this one thing
Accord
Accord15mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts