Getting following error when i run the nodejs lambda code.
"errorType": "Runtime.HandlerNotFound", "errorMessage": "index.handler is undefined or not exported",
the folder structure is
audit_package
- nodejs
- node.js
The lambda handler name is "index.handler" runtime package is "nodejs12.x"
Dont pass any paramters while invoking lambda.
Here is the code
console.log('function starts');
const AWS = require('aws-sdk');
const docClient = new AWS.DynamoDB.DocumentClient({region: 'us-west-2'});
exports.handler = function(event, context, callback){
console.log('processing event: %j', event);
let scanningParameters = {
TableName: 'epro-audit-cert',
Limit: 10 //maximum result of 100 items
};
//In dynamoDB scan looks through your entire table and fetches all data
docClient.scan(scanningParameters, function(err,data){
if(err){
callback(err, null);
}else{
callback(null,data);
}
});