Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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