Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce max for timeout and update README docs #180

Merged
merged 3 commits into from
Feb 9, 2017
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ $ node-lambda run --help
-j, --eventFile [event.json] Event JSON File
-f, --configFile [] Path to file holding secret environment variables (e.g. "deploy.env")
-u, --runtime [nodejs4.3] Lambda Runtime {nodejs4.3, nodejs} - "nodejs4.3" is the current standard, "nodejs" is v0.10.36
-t, --timeout [3] Lambda Timeout in seconds (max of 300)
-x, --contextFile [context.json] Context JSON file
```

Expand Down Expand Up @@ -142,6 +143,14 @@ a callback function. These will still work for now for backward compatibility,

v0.10.36 is still supported, and can be targeted by changing the `AWS_RUNTIME` value to `nodejs` in the `.env` file.

Runtime context options available :

- context.getRemainingTimeInMillis()
- context.done() ***deprecated***
- context.fail() ***deprecated***
- context.succeed() ***deprecated***


## Post install script
When running `node-lambda deploy` if you need to do some action after `npm install --production` and before deploying to AWS Lambda (e.g. replace some modules with precompiled ones or download some libraries, replace some config file depending on environment) you can create `post_install.sh` script. If the file exists the script will be executed (and output shown after execution) if not it is skipped. Environment string is passed to script as first parameter so you can use it if needed. Make sure that the script is executable.

Expand Down
2 changes: 1 addition & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Lambda.prototype.run = function (program) {
Lambda.prototype._runHandler = function (handler, event, program, context) {

var startTime = new Date();
var timeout = program.timeout * 1000; // convert the timeout into milliseconds
var timeout = Math.min(program.timeout, 300) * 1000; // convert the timeout into milliseconds

var callback = function (err, result) {
if (err) {
Expand Down