AWS S3 promise meteor
<p>So, I'm using <code>AWS = Npm.require('aws-sdk');</code> from Amazon.</p>

<p>Apparently promise are implemented. <a href="http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Request.html#promise-property" rel="nofollow">http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Request.html#promise-property</a></p>

<p>See my functions (Server):</p>

<pre><code>s3 = new AWS.S3({ apiVersion: "2006-03-01" });

bucketExists = (bucket) =&gt; {
  check(bucket, String);

  const params = {
    Bucket: bucket
  };

  return s3.putObject({Bucket: 'bucket', Key: 'key'}).promise();
};


Meteor.methods({
  addPhoto(userId, photo) {
    check(userId, String);
    check(photo, Object);

    bucketExists(userId)
    .then(
      function(value) {
        console.log("Contents: " + value);
      })
    .catch(function(reason) {
      console.error("Error or timeout", reason);
    });
  }
});
</code></pre>

<p>Exeption:</p>

<pre><code>Exception while invoking method 'addPhoto' TypeError: Object [object Object] has no method 'promise'.
</code></pre>

<p>WTF</p>

<p>So, I try without call promise(). Like that:</p>

<pre><code>bucketExists = (bucket) =&gt; {
  check(bucket, String);

  const params = {
    Bucket: bucket
  };

  return new Promise(
    (resolve, reject) =&gt; {
      s3.waitFor('bucketExists', params, (err, res) =&gt; {
        if (err) reject(err);
        else resolve(res);
      });
    });
};
</code></pre>

<p>But nothing appear. I start with ES6. So please help.</p>

<p>Thanks</p>