Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Commit e316664

Browse files
author
Cristiano Diniz da Silva
authored
Updating index.js to use Node v4.3
As mentioned in AWS documentation to migrate from Node v0.10 to v4.3, context functions would need to be updated to use the new nomenclature. ref: http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-using-old-runtime.html#transition-to-new-nodejs-runtime This commit will update the `context` functions of: * context.fail(object) * context.succeed() To Node v4.3 format following what is suggested by the documentation provided by AWS.
1 parent 3f2214a commit e316664

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ exports.handler = function(event, context) {
4848
});
4949
}, function(err, images) {
5050
if (err) {
51-
context.fail(err);
51+
context.callbackWaitsForEmptyEventLoop = false;
52+
callback(err, 'Failed result');
5253
} else {
5354
var resizePairs = cross(CONFIG.sizes, images);
5455
async.eachLimit(resizePairs, CONFIG.concurrency, function(resizePair, cb) {
@@ -70,9 +71,11 @@ exports.handler = function(event, context) {
7071
});
7172
}, function(err) {
7273
if (err) {
73-
context.fail(err);
74+
context.callbackWaitsForEmptyEventLoop = false;
75+
callback(err, 'Failed result');
7476
} else {
75-
context.succeed();
77+
context.callbackWaitsForEmptyEventLoop = false;
78+
callback(null, 'Success message');
7679
}
7780
});
7881
}

0 commit comments

Comments
 (0)