我使用從AWS控制檯測試功能:AWS LAMBDA獲取上下文信息
console.log('Loading event');
exports.handler = function(event, context) {
console.log('value1 = ' + event.key1);
console.log('value2 = ' + event.key2);
console.log('value3 = ' + event.key3);
context.done(null, 'Hello World'); // SUCCESS with message
};
,並呼籲它的NodeJS如下:
var params = {
FunctionName: 'MY_FUNCTION_NAME', /* required */
InvokeArgs: JSON.stringify({
"key1": "value1",
"key2": "value2",
"key3": "value3"
})
};
lambda.invokeAsync(params, function(err, data) {
if (err) {
// an error occurred
console.log(err, err.stack);
return cb(err);
}
// successful response
console.log(data);
});
,一切工作正常:
//Console Output
{ Status: 202 }
但我期待從context.done(null,'Message')接收消息以及...
任何想法如何獲取消息?