admin管理员组

文章数量:1391947

I have the following node.js javascript code using aws-sdk/client-s3:

console.log("Begin Program");

const client = getS3Client();
const params = { Bucket: "my_bucket", Key: "my_file" }
const cmd = new GetObjectCommand(params)

try {
 const resp = await client.send(cmd);
 const str = await response.Body.transformToString();
 console.log(str);
} catch (err) {
 console.log(err);
}

console.log("End Program");

When I run this code, 2 out of 20 times, the code would execute the console.log(str) line and I would see the content of the file I download. The rest of the times, I only see "Begin Program".

I am not sure why the program would behave differently from run to run. Am I using the client.send() wrong therefore await is not allowing the promise returned by client.send() to be fulfilled before proceeding?

Is there a known bug in the AWS S3Client?

I don't see the console.log(err) executed ever so I don't think the program crashed with an "exception".

Thank you for your help in advance!

I have tried different version of the aws-sdk/client-s3 version 3.689 and the latest version. But I get the same error

本文标签: