Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

142
Views
Javascript AWS S3.upload gives a promise?

The AWS instructions on S3 uploading (https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3/ManagedUpload.html) would suggest that the following should work.

var managed = s3.upload(params, function(err, data) {
    if (err) {
        throw err;
    }
    console.log(`File uploaded successfully. ${data.Location}`);
});
p = managed.promise();
console.log(p);

s3.upload returns a ManagedUpload object, and this seems to be working. Supposedly the object has a promise() method that returns a promise that could be used with the .then programming style. However, when I actually try I'm getting

Uncaught TypeError TypeError: managed.promise is not a function

Is this documentation out of date? Is there a better one somewhere?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

From the docs in upload() just enter the parameters, then() method should be called on the promise object to handle a result (resolve) or an error (reject).

var upload = s3.upload({Bucket: 'bucket', Key: 'key', Body: stream});
var promise = upload.promise();
promise.then(function(data) { ... }, function(err) { ... });
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!