admin管理员组文章数量:1278786
I have successfully invoked a lambda function from within my node file. It returns 200 and success, but I need to pass in a value to the function I am calling and am unsure how to do that. I am beginning to learn lambda and believe I am not understanding correctly how some things operate. I am attempting to pass in an email address to the lambda function.
function callLambda(){
var AWS = require('aws-sdk');
AWS.config.region = 'us-west-2'
var lambda = new AWS.Lambda();
var params = {
FunctionName: 'UploadDailyRecords',
Payload: '{"client_id" : "[email protected]"}'
};
lambda.invoke(params, function(err, data) {
if (err) console.log(err, err.stack);
else console.log(data);
});
}
callLambda();
Also, I am unsure of the correct format of how to invoke it from the other function to accept a variable from this invocation. This is the way the invoked lambda is set up on AWS.
exports.handler = function(event, context, callback) {
get_clients_email();
callback(null, "pleted");
}
Thanks for any help.
I have successfully invoked a lambda function from within my node file. It returns 200 and success, but I need to pass in a value to the function I am calling and am unsure how to do that. I am beginning to learn lambda and believe I am not understanding correctly how some things operate. I am attempting to pass in an email address to the lambda function.
function callLambda(){
var AWS = require('aws-sdk');
AWS.config.region = 'us-west-2'
var lambda = new AWS.Lambda();
var params = {
FunctionName: 'UploadDailyRecords',
Payload: '{"client_id" : "[email protected]"}'
};
lambda.invoke(params, function(err, data) {
if (err) console.log(err, err.stack);
else console.log(data);
});
}
callLambda();
Also, I am unsure of the correct format of how to invoke it from the other function to accept a variable from this invocation. This is the way the invoked lambda is set up on AWS.
exports.handler = function(event, context, callback) {
get_clients_email();
callback(null, "pleted");
}
Thanks for any help.
Share Improve this question edited Apr 12, 2017 at 17:04 Mike asked Apr 12, 2017 at 14:59 MikeMike 3282 gold badges4 silver badges13 bronze badges 1- What did the final solution look like here? How would it work if I need to pass to attributes in the Payload object? – lopezdp Commented Aug 13, 2020 at 14:18
1 Answer
Reset to default 9Everything looks good, you just need to access the payload parameter in your Lambda function now via event.client_id
.
本文标签: javascriptPassing in value to an invoked lambda function from nodejs functionStack Overflow
版权声明:本文标题:javascript - Passing in value to an invoked lambda function from node.js function - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741219402a2360674.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论