title: Node JS file upload with AWS SDK | Error: Cannot determine length of [object Object]
body: <p>I'm trying to use the AWS SDK on my sails js app. I keep getting this error: Cannot determine length of [object Object]. Does anyone know whats causing this?</p>
  
  <p>Here is the code: </p>
  
  <p>var AWS = require('aws-sdk');</p>
  
  <pre><code>              var s3bucket = new AWS.S3({
                  accessKeyId : 'xxx',
                  secretAccessKey : 'xxx',
                  params: {Bucket: 'sweetestspots'}
                });
                var body = req.file('cover');
  
                s3bucket.upload({Key: 'filename', ACL:'public-read', Body:body}, function(err, data) {
                  console.log ("data")
                  console.log (data)
                  if (err) {
                    console.log("Error uploading data: ", err);
                    return res.send("err");
  
                  } else {
                    console.log("Successfully uploaded data to myBucket/myKey");
                    console.log(data);
  
                    return res.send("uploaded");
                  }
                });
  </code></pre>