Skip to content

Instantly share code, notes, and snippets.

@alexbilbie
Created November 19, 2015 11:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexbilbie/cd1a1309bd7267d860b0 to your computer and use it in GitHub Desktop.
Save alexbilbie/cd1a1309bd7267d860b0 to your computer and use it in GitHub Desktop.
Lambda run.js for local testing
// Import the Lambda function
var lambda = require('./MyModule');
// Faking the Lambda context object
var context = {
done: function (error, success) {
console.log('-------DONE--------');
if (error !== undefined && error !== null) {
console.log('Error: ' + error);
}
if (success !== undefined && success !== null) {
console.log('Success: ' + success);
}
},
fail: function (error) {
console.log('--------FAIL-------');
console.log('');
console.log(JSON.stringify(error));
},
succeed: function (success) {
console.log('-------SUCCESS-------');
console.log('success');
console.log(JSON.stringify(success));
}
};
lambda.handler(
// Edit this below:
{
"Records": [
{
"Sns": {
"Subject": "SUBJECT NAME",
"Message": JSON.stringify({
"lambda": {
}
})
}
}
]
},
// Leave this in place
context
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment