feat: check if maxun-run-screenshots bucket is created

This commit is contained in:
karishmas6
2024-10-30 04:02:59 +05:30
parent 0d4680d328
commit 239412bc09

View File

@@ -35,7 +35,7 @@ async function createBucketWithPolicy(bucketName: string, policy?: 'public-read'
Statement: [ Statement: [
{ {
Effect: "Allow", Effect: "Allow",
Principal: "*", Principal: "",
Action: ["s3:GetObject"], Action: ["s3:GetObject"],
Resource: [`arn:aws:s3:::${bucketName}/*`] Resource: [`arn:aws:s3:::${bucketName}/*`]
} }
@@ -130,6 +130,7 @@ class BinaryOutputService {
} }
async uploadBinaryOutputToMinioBucket(run: Run, key: string, data: Buffer): Promise<void> { async uploadBinaryOutputToMinioBucket(run: Run, key: string, data: Buffer): Promise<void> {
await createBucketWithPolicy('maxun-run-screenshots', 'public-read');
const bucketName = 'maxun-run-screenshots'; const bucketName = 'maxun-run-screenshots';
try { try {
console.log(`Uploading to bucket ${bucketName} with key ${key}`); console.log(`Uploading to bucket ${bucketName} with key ${key}`);