具有nodejs的AWS失败,BucketAlreadyOwnedByYou错误

时间:2016-01-05 02:47:40

标签: javascript node.js amazon-web-services amazon-s3

我使用此npm https://github.com/RiptideElements/s3fs并出现

错误
Unhandled rejection BucketAlreadyOwnedByYou: Your previous request to create the
 named bucket succeeded and you already own it.

在我的app.js中我做了

var s3 = require('./config/db.js');
var fs = require('fs');
var S3FS = require('s3fs');

var s3_config = require('./config/s3_config');
var s3fsImpl = new S3FS(s3_config.bucket,{
  accessKeyId : s3_config.key,
  secretAccessKey : s3_config.secret
});
s3fsImpl.create();

有任何想法或提示我为什么会收到错误?

1 个答案:

答案 0 :(得分:1)

来自the documentation

  

public static void main(String[] args) throws Exception { SendMail a = new SendMail(); a.postMail(); } public void postMail() { MimeMessage message = null; try { Properties mailProp = new Properties(); mailProp.put("mail.smtp.host","smtp.bizmail.yahoo.com"); mailProp.put("mail.smtp.port","465"); mailProp.put("mail.smtp.auth","true"); mailProp.put("mail.smtp.socketFactory.port", "465"); mailProp.put("mail.smtp.socketFactory.fallback","false"); mailProp.put("mail.smtp.starttls.enable","true");//true: ssl, false : non ssl mailProp.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory"); mailProp.put("mail.pop3.host", "pop.bizmail.yahoo.com"); mailProp.put("mail.pop3.port", "995"); Authenticator auth = new Authenticator() { //override the getPasswordAuthentication method protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("myemail", "mypassword"); } }; Session session = Session.getInstance(mailProp, auth); session.setDebug(true); message = new MimeMessage(session); message.setFrom(new InternetAddress("emailid@yahoo.com")); message.addRecipient(Message.RecipientType.TO, new InternetAddress("emailreceipt@yahoo.com")); message.setSubject("Hello JavaMail"); message.setText("Welcome to Yahoo's JavaMail"); // Send message Transport.send(message); System.out.println("Message Sent"); } catch (Exception e) { e.printStackTrace(); } }

     

在S3上创建一个新存储桶。

您似乎正在调用创建新S3存储桶的方法。存储桶是否已经存在?