title: lambda nodejs error index.handler is undefined or not exported
body: <p>Getting following error when i run the nodejs lambda code.</p>
  <p>&quot;errorType&quot;: &quot;Runtime.HandlerNotFound&quot;,
  &quot;errorMessage&quot;: &quot;index.handler is undefined or not exported&quot;,</p>
  <p>the folder structure is</p>
  <pre><code>audit_package
   - nodejs
      - node.js
  </code></pre>
  <p>The lambda handler name is  &quot;index.handler&quot;
  runtime package is &quot;nodejs12.x&quot;</p>
  <p>Dont pass any paramters while invoking lambda.</p>
  <p>Here is the code</p>
  <pre><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);
          }
      });
  </code></pre>