@kfreytag responding to @Nopik
Responding to your question from early this morning about SNS-triggered lambdas. In my experience, you only get one message / Record at a time. Here’s my revised JAWS handler wherein I always deal with a JobId
'use strict'; | |
// from @kfreytag on guitar #serverless/serverless | |
require('jaws-core-js/env'); | |
// Modularized Code | |
var action = require('./index.js'); | |
// Lambda Handler | |
module.exports.handler = function(event, context) { | |
if ("Records" in event) { | |
// It's an SNS message; | |
action.run({ JobId: event.Records[0].Sns.MessageAttributes.JobId.Value }, context, function(error, result) { | |
return context.done(error, result); | |
}); | |
} else { | |
action.run(event, context, function(error, result) { | |
return context.done(error, result); | |
}); | |
} | |
}; |