From cf08e2836c81b4b7c9a4a908ac7b35c17f47ffe0 Mon Sep 17 00:00:00 2001 From: Chase Sillevis Date: Tue, 12 Apr 2016 13:26:12 +0200 Subject: [PATCH 1/5] Runhandler: Hotfixes --- lib/main.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index ce273096..c0f367d9 100644 --- a/lib/main.js +++ b/lib/main.js @@ -52,7 +52,7 @@ Lambda.prototype._runHandler = function (handler, event, runtime) { var callback = function (err, result) { if (err) { - console.log('Error: ' + error); + console.log('Error: ' + err); process.exit(-1); } else { @@ -67,19 +67,19 @@ Lambda.prototype._runHandler = function (handler, event, runtime) { var context = { isNode43: runtime === "nodejs4.3", succeed: function (result) { - if (isNode43) { + if (this.isNode43) { console.log('context.succeed() is deprecated with Node.js 4.3 runtime'); } callback(null, result); }, fail: function (error) { - if (isNode43) { + if (this.isNode43) { console.log('context.fail() is deprecated with Node.js 4.3 runtime'); } callback(error); }, done: function () { - if (isNode43) { + if (this.isNode43) { console.log('context.done() is deprecated with Node.js 4.3 runtime'); } callback(); From fdbbe605dbe0abf6dabe304acb05efde05466319 Mon Sep 17 00:00:00 2001 From: Chase Sillevis Date: Mon, 18 Apr 2016 13:17:47 +0200 Subject: [PATCH 2/5] Remove AWS_MODE --- lib/.env.example | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/.env.example b/lib/.env.example index 66f81f71..a5a22808 100644 --- a/lib/.env.example +++ b/lib/.env.example @@ -6,7 +6,6 @@ AWS_ROLE_ARN=your_amazon_role AWS_REGION=us-east-1 AWS_FUNCTION_NAME= AWS_HANDLER=index.handler -AWS_MODE=event AWS_MEMORY_SIZE=128 AWS_TIMEOUT=3 AWS_DESCRIPTION= From 9c94a46acc15dbccc4e0307bff0a41dffbcd6616 Mon Sep 17 00:00:00 2001 From: Chase Sillevis Date: Mon, 18 Apr 2016 13:20:37 +0200 Subject: [PATCH 3/5] Set nodejs4.3 as default --- lib/.env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/.env.example b/lib/.env.example index a5a22808..1fd0bcd2 100644 --- a/lib/.env.example +++ b/lib/.env.example @@ -9,7 +9,7 @@ AWS_HANDLER=index.handler AWS_MEMORY_SIZE=128 AWS_TIMEOUT=3 AWS_DESCRIPTION= -AWS_RUNTIME=nodejs +AWS_RUNTIME=nodejs4.3 AWS_VPC_SUBNETS= AWS_VPC_SECURITY_GROUPS= EXCLUDE_GLOBS="event.json" From 98e89a5a9c893c1c50cbd6a203f66665213b5068 Mon Sep 17 00:00:00 2001 From: Chase Sillevis Date: Fri, 22 Apr 2016 17:43:16 +0200 Subject: [PATCH 4/5] Fix #87 --- lib/main.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/main.js b/lib/main.js index 76fdfc03..64883e14 100644 --- a/lib/main.js +++ b/lib/main.js @@ -138,14 +138,14 @@ Lambda.prototype._zipfileTmpPath = function (program) { }; Lambda.prototype._rsync = function (program, codeDirectory, callback) { - var excludes = ['.git*', '*.swp', '.editorconfig', 'deploy.env', '*.log', 'node_modules'], - excludeArgs = ''; + var excludes = ['.git*', '*.swp', '.editorconfig', 'deploy.env', '*.log', 'node_modules', 'build/'], + excludeGlobs = []; if (program.excludeGlobs) { - var excludeGlobs = program.excludeGlobs.split(' '); - excludeArgs = excludeGlobs.concat(excludes).map(function(exclude) { - return '--exclude=' + exclude; - }).join(' '); + excludeGlobs = program.excludeGlobs.split(' '); } + var excludeArgs = excludeGlobs.concat(excludes).map(function(exclude) { + return '--exclude=' + exclude; + }).join(' '); exec('mkdir -p ' + codeDirectory, function(err) { if (err) { @@ -335,12 +335,12 @@ Lambda.prototype._archive = function (program, archive_callback) { var _this = this; var codeDirectory = _this._codeDirectory(program); - console.log('=> Moving files to temporary directory'); - // Move all files to tmp folder (except .git, .log, event.json and node_modules) _this._cleanDirectory(codeDirectory, function(err) { if (err) { return archive_callback(err); } + console.log('=> Moving files to temporary directory'); + // Move files to tmp folder _this._rsync(program, codeDirectory, function (err) { if (err) { return archive_callback(err); From ccac8973a2c980bfbf258e12ccb1e913e0338516 Mon Sep 17 00:00:00 2001 From: Chase Sillevis Date: Fri, 22 Apr 2016 17:45:26 +0200 Subject: [PATCH 5/5] node_modules should not be ignored, lambda needs it! --- lib/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/main.js b/lib/main.js index 64883e14..db0ba6f7 100644 --- a/lib/main.js +++ b/lib/main.js @@ -138,7 +138,7 @@ Lambda.prototype._zipfileTmpPath = function (program) { }; Lambda.prototype._rsync = function (program, codeDirectory, callback) { - var excludes = ['.git*', '*.swp', '.editorconfig', 'deploy.env', '*.log', 'node_modules', 'build/'], + var excludes = ['.git*', '*.swp', '.editorconfig', 'deploy.env', '*.log', 'build/'], excludeGlobs = []; if (program.excludeGlobs) { excludeGlobs = program.excludeGlobs.split(' ');