Skip to content

Commit 07f6254

Browse files
committed
Merge pull request #3 from aidancasey/master
Making the Lambda timeout value configurable from grunt options file
2 parents 19e4195 + 5e054b6 commit 07f6254

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,12 @@ Default value: `us-east-1`
341341
Specify the AWS region, useful if you'd normally operate in a certain region (such as one where Lambda isn't yet available)
342342
but wish to upload functions to another region.
343343

344+
##### options.timeout
345+
Type: `Integer`
346+
Default value: `null`
347+
Depending on your Lambda function, you might need to increase the timeout value. The default timeout assigned by AWS is currently 3 seconds.
348+
If you wish to increase this timeout set the value here.
349+
344350
#### Usage Examples
345351

346352
##### Default Options
@@ -355,7 +361,23 @@ grunt.initConfig({
355361
}
356362
});
357363
```
358-
And now if you run `grunt lambda_deploy` your package shoudl be created and uploaded to the specified function.
364+
And now if you run `grunt lambda_deploy` your package should be created and uploaded to the specified function.
365+
366+
367+
##### Increasing the Timeout Options to 10 seconds
368+
In this example, the timeout value is increased to 10 seconds.
369+
370+
```js
371+
grunt.initConfig({
372+
lambda_deploy: {
373+
default: {
374+
function: 'my-lambda-function',
375+
timeout : 10
376+
377+
}
378+
}
379+
});
380+
```
359381

360382
## Misc info
361383

tasks/lambda_deploy.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ module.exports = function (grunt) {
3535

3636
var deploy_function = grunt.config.get('lambda_deploy.' + this.target + '.function');
3737
var deploy_package = grunt.config.get('lambda_deploy.' + this.target + '.package');
38+
var deploy_timeout = grunt.config.get('lambda_deploy.' + this.target + '.options.timeout');
3839

3940
AWS.config.update({region: options.region});
4041

@@ -62,6 +63,11 @@ module.exports = function (grunt) {
6263
Runtime: current.Runtime
6364
};
6465

66+
if (deploy_timeout !== null)
67+
{
68+
params.Timeout = deploy_timeout;
69+
}
70+
6571
grunt.log.writeln('Uploading...');
6672
fs.readFile(deploy_package, function (err, data) {
6773
params['FunctionZip'] = data;

0 commit comments

Comments
 (0)