Skip to content

Commit 36c808f

Browse files
14pixelsDeviaVir
authored andcommitted
Added option for increasing the connection timeout of the aws-sdk in deploy step (motdotla#159)
* Added option for increasing the connection timeout of the aws-sdk in deploy step * added parseInt to ensure timeout is an integer
1 parent c0369f9 commit 36c808f

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ $ node-lambda deploy --help
135135
-x, --excludeGlobs [] Add a space separated list of file(type)s to ignore (e.g. "*.json .env")
136136
-D, --prebuiltDirectory [] Prebuilt directory
137137
-z, --deployZipfile [] Deploy zipfile
138+
-T, --deployTimeout [120000] Deploy Timeout
138139
```
139140

140141
## Custom Environment Variables

bin/node-lambda

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ var EVENT_FILE = process.env.EVENT_FILE || 'event.json';
7171
var PACKAGE_DIRECTORY = process.env.PACKAGE_DIRECTORY;
7272
var CONTEXT_FILE = process.env.CONTEXT_FILE || 'context.json';
7373
var PREBUILT_DIRECTORY = process.env.PREBUILT_DIRECTORY || '';
74+
var DEPLOY_TIMEOUT = process.env.DEPLOY_TIMEOUT || 120000;
7475
var DOCKER_IMAGE = process.env.DOCKER_IMAGE || '';
7576
var DEPLOY_ZIPFILE = process.env.DEPLOY_ZIPFILE || '';
7677
var AWS_DLQ_TARGET_ARN = (function() {
@@ -117,6 +118,7 @@ program
117118
.option('-x, --excludeGlobs [' + EXCLUDE_GLOBS + ']',
118119
'Space-separated glob pattern(s) for additional exclude files (e.g. "event.json dotenv.sample")', EXCLUDE_GLOBS)
119120
.option('-D, --prebuiltDirectory [' + PREBUILT_DIRECTORY + ']', 'Prebuilt directory', PREBUILT_DIRECTORY)
121+
.option('-T, --deployTimeout [' + DEPLOY_TIMEOUT + ']', 'Deploy Timeout', DEPLOY_TIMEOUT)
120122
.option('-z, --deployZipfile [' + DEPLOY_ZIPFILE + ']', 'Deploy zipfile', DEPLOY_ZIPFILE)
121123
.action(function (prg) {
122124
lambda.deploy(prg);

lib/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,10 @@ Lambda.prototype.deploy = function (program) {
736736
aws_security.sessionToken = program.sessionToken;
737737
}
738738

739+
if (program.deployTimeout) {
740+
aws.config.httpOptions.timeout = parseInt(program.deployTimeout);
741+
}
742+
739743
aws.config.update(aws_security);
740744

741745
var lambda = new aws.Lambda({

test/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var originalProgram = {
3030
eventFile: 'event.json',
3131
eventSourceFile: '',
3232
contextFile: 'context.json',
33+
deployTimeout: 120000,
3334
prebuiltDirectory: '',
3435
};
3536

0 commit comments

Comments
 (0)