【发布时间】:2014-12-16 23:45:11
【问题描述】:
我正在使用节点 AWS SDK 将图像保存到 s3。尽管存储桶存在并且我拥有正确的权限,但我仍然收到以下错误:
{ [NoSuchBucket: The specified bucket does not exist]
message: 'The specified bucket does not exist',
code: 'NoSuchBucket',
time: Tue Oct 21 2014 12:32:50 GMT-0400 (EDT),
statusCode: 404,
retryable: false }
我的nodejs代码:
var fs = require('fs');
var AWS = require('aws-sdk'); //AWS library (used to provide temp credectials to a front end user)
AWS.config.loadFromPath('./AWS_credentials.json'); //load aws credentials from the authentication text file
var s3 = new AWS.S3();
fs.readFile(__dirname + '/image.jpg', function(err, data) {
var params = {
Bucket: 'https://s3.amazonaws.com/siv.io',
Key: 'something',
};
s3.putObject(params, function(err, data) {
if (err) {
console.log(err);
} else {
console.log("Successfully uploaded data to myBucket/myKey");
}
});
});
我还尝试使用 siv.io.s3-website-us-east-1.amazonaws.com 作为存储桶名称。有人可以让我知道我出了什么问题吗?如有需要,我可以提供更多信息。
【问题讨论】:
标签: node.js amazon-web-services amazon-s3