Skip to content

Commit

Permalink
chore: fix ListObjectsV2Command
Browse files Browse the repository at this point in the history
  • Loading branch information
ilfa committed Sep 20, 2024
1 parent 1848c89 commit ff982f9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions e2e/scripts/cleanup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ import {
ListCachePoliciesCommand,
ListOriginRequestPoliciesCommand,
} from '@aws-sdk/client-cloudfront'
import { DeleteBucketCommand, DeleteObjectsCommand, ListBucketsCommand, S3Client } from '@aws-sdk/client-s3'
import {
DeleteBucketCommand,
DeleteObjectsCommand,
ListBucketsCommand,
ListObjectsV2Command,
S3Client
} from "@aws-sdk/client-s3"

const lambda = new LambdaClient()
const secretsManager = new SecretsManagerClient()
Expand Down Expand Up @@ -197,7 +203,8 @@ async function* listS3Buckets() {
}

async function emptyS3Bucket(bucketName) {
const listedObjects = await s3.listObjectsV2({ Bucket: bucketName }).promise()
const listObjectsCommand = new ListObjectsV2Command({ Bucket: bucketName })
const listedObjects = await s3.send(listObjectsCommand)

if (listedObjects.Contents.length === 0) {
return
Expand Down

0 comments on commit ff982f9

Please sign in to comment.