Created
February 18, 2016 13:06
-
-
Save cagataygurturk/c6e94d439f1b2964193c to your computer and use it in GitHub Desktop.
Lambda debug locally
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Used to debug locally node.js files | |
* | |
* Usage: | |
* | |
* node debug.js function_to_run.js event_file.json | |
* | |
* Make sure that you have dotenv in package json for environment support. | |
*/ | |
require('dotenv').config(); | |
var functionToDebug = require(process.argv[2]); | |
if (process.argv[3]) { | |
event = require(process.argv[3]); | |
} | |
var callback = function (err, message) { | |
if (err) { | |
console.log("ERROR: " + JSON.stringify(err)); | |
return; | |
} | |
console.log("SUCCESS: " + JSON.stringify(message)); | |
}; | |
functionToDebug.respond(event, callback); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment