Jon*_*God 3 amazon-web-services node.js aws-lambda
我正在使用AWS控制台的测试功能:
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
};
Run Code Online (Sandbox Code Playgroud)
并在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);
});
Run Code Online (Sandbox Code Playgroud)
一切正常:
//Console Output
{ Status: 202 }
Run Code Online (Sandbox Code Playgroud)
但我期待从context.done(null,'Message')收到消息......
知道如何获取消息吗?
| 归档时间: |
|
| 查看次数: |
2904 次 |
| 最近记录: |