fix: implement S3 listBuckets to actually list buckets

- Add @aws-sdk/client-s3 dependency for direct S3 operations
- Fix listBuckets handler which was hardcoded to return empty array
- Now properly queries S3 and returns actual bucket names
This commit is contained in:
2026-01-23 23:28:04 +00:00
parent f64fc069d4
commit a7ee9dff9f
5 changed files with 18 additions and 4 deletions

View File

@@ -19,9 +19,15 @@ export async function registerS3Handlers(
return { buckets: [] };
}
// SmartBucket doesn't have a direct listBuckets method
// For now return empty - in a full implementation you'd use the underlying S3 client
return { buckets: [] };
try {
const command = new plugins.s3.ListBucketsCommand({});
const response = await smartbucket.s3Client.send(command) as plugins.s3.ListBucketsCommandOutput;
const buckets = response.Buckets?.map(b => b.Name).filter((name): name is string => !!name) || [];
return { buckets };
} catch (err) {
console.error('Error listing buckets:', err);
return { buckets: [] };
}
}
)
);