Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 28 additions & 26 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ Lambda.prototype.deploy = function (program) {
'FunctionName': params.FunctionName
}, function (err) {
if (err) {
// Function does not exist
return _this._uploadNew(lambda, params, function(err, results) {
if (err) {
throw err;
Expand All @@ -609,34 +610,35 @@ Lambda.prototype.deploy = function (program) {
cb(null, results);
});
});
} else {
_this._listEventSourceMappings(lambda, {
'FunctionName': params.FunctionName
}, function(err, existingEventSourceList) {
if (err) {
throw err;
}

// Function exists
_this._listEventSourceMappings(lambda, {
'FunctionName': params.FunctionName
}, function(err, existingEventSourceList) {
if (err) {
throw err;
}
return async.parallel([
function(_callback) {
_this._uploadExisting(lambda, params, function(err, results) {
if (err) {
throw err;
}
console.log('=> Zip file(s) done uploading. Results follow: ');
console.log(results);
_callback(err, results);
});
},
function(_callback) {
_this._updateEventSources(lambda, params.FunctionName, existingEventSourceList, eventSourceList, function(err, results) {
_callback(err, results);
});
}
return async.parallel([
function(_callback) {
_this._uploadExisting(lambda, params, function(err, results) {
if (err) {
throw err;
}
console.log('=> Zip file(s) done uploading. Results follow: ');
console.log(results);
_callback(err, results);
})
},
function(_callback) {
_this._updateEventSources(lambda, params.FunctionName, existingEventSourceList, eventSourceList, function(err, results) {
_callback(err, results)
})
}
], function(err, results) {
cb(err, results);
});
], function(err, results) {
cb(err, results);
});
}
});
});
}, function (err, results) {
if (err) {
Expand Down