node.js - S3 upload sending events is working locally with deferred.notify() but not on server -
i sending object s3 upload , locally 'httpuploadprogress' event. notifies .progress call on function , updates record progress. works fine locally not on server. ideas appreciated. i've included 2 snippets of code. i'm using google servers, not sure if it's issue code or server settings :/
s3.uploadvideo = function (filepath, videoname, publisher_id) { var deferred = q.defer(); var body = fs.createreadstream(filepath); var s3obj = new aws.s3({ params: { bucket: transcodeconfig.nontranscodedvideobucket, key: publisher_id + '/' + videoname } }); s3obj.upload({body: body}). on('httpuploadprogress', function (evt) { deferred.notify(evt); return }). send(function (err, data) { if (!err) { deferred.resolve(data); return } else { deferred.reject(err); return } }); //deferred.resolve({}) return deferred.promise; }
aws_api.s3.uploadvideo(file.path, filename, publisher_id ).progress(function(progress){ return models.videos.findoneandupdate({_id : trackingid},{uploadprogress: progress, file_type:fileextension},function(err,data){ if(err){ return next(err); }else{ return data; } }) })
Comments
Post a Comment