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
本文标签:
版权声明:本文标题:javascript - S3Client.send(new GetObjectCommand(...)) sometimes terminates the program without raising an exception - Stack Over 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744671187a2618832.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论