Promise not working in JS worker

Hi I have am using the S3 client in a Cloudflare worker
import {GetObjectCommand, ListObjectsV2Command, ListObjectsV2CommandOutput, S3Client} from "@aws-sdk/client-s3";

// Create client
const S3: S3Client = new S3Client({
    region: "auto",
    endpoint: `https://${accountid}.r2.cloudflarestorage.com`,
    credentials: {
        accessKeyId: env.AWS_ACCESS_KEY_ID,
        secretAccessKey: env.AWS_SECRET_ACCESS_KEY,
    },
});


If I use
await
syntax I can log the results from this call in a Worker

const item: ListObjectsV2CommandOutput = await S3.send(new ListObjectsV2Command({Bucket: 'pics'}));
item.Contents.map((item) => {
    console.log(item.Key);})


If I try the same thing using .then() syntax I do not get any logs

S3.send(
    new ListObjectsV2Command({Bucket: 'pics'})
).then((item) => {
    console.log(item.Contents[0].Key)});


Can anyone please explain why?
Was this page helpful?