title: Query attempt using Node.js dynamoDB document client is not working
body: <p>I am trying to write a lambda function that retrieves data from a dynamodb table which is called <code>simul-MOCK_LEADS_TBL</code>. I have come up with the following nodejs code to achieve this:</p>
  
  <pre><code>const AWS = require('aws-sdk');
  const docClient = new AWS.DynamoDB.DocumentClient({region: 'us-west-2'}); 
  
  exports.handler = (event, context, callback) =&gt; {
      // TODO implement
  var table = "simul-MOCK_LEADS_TBL";
  var lead_email = "hwdnpny@xyz.com";
    var params = {
      TableName: table,
      Key:{
          "lead_email": lead_email
      }
  };
    docClient.get(params, function(err, data) {
      if(err) { 
        callback(err, null);
      } else { 
        callback(null, data.Items); 
      }
    });
  }
  </code></pre>
  
  <p>The ultimate goal is to basically query the table based on the email which will passed in the event key. However, I keep getting the following error:</p>
  
  <pre><code>Response:
  {
    "errorMessage": "The provided key element does not match the schema",
    "errorType": "ValidationException",
    "stackTrace": [
      "Request.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/json.js:48:27)",
      "Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:105:20)",
      "Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:77:10)",
      "Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:683:14)",
      "Request.transition (/var/runtime/node_modules/aws-sdk/lib/request.js:22:10)",
      "AcceptorStateMachine.runTo (/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12)",
      "/var/runtime/node_modules/aws-sdk/lib/state_machine.js:26:10",
      "Request.&lt;anonymous&gt; (/var/runtime/node_modules/aws-sdk/lib/request.js:38:9)",
      "Request.&lt;anonymous&gt; (/var/runtime/node_modules/aws-sdk/lib/request.js:685:12)",
      "Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:115:18)"
    ]
  }
  
  Request ID:
  "7d76c52a-3c61-11e8-b415-093987d0d3bc"
  
  Function Logs:
  START RequestId: 7d76c52a-3c61-11e8-b415-093987d0d3bc Version: $LATEST
  2018-04-10T01:50:05.834Z    7d76c52a-3c61-11e8-b415-093987d0d3bc    {"errorMessage":"The provided key element does not match the schema","errorType":"ValidationException","stackTrace":["Request.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/json.js:48:27)","Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:105:20)","Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:77:10)","Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:683:14)","Request.transition (/var/runtime/node_modules/aws-sdk/lib/request.js:22:10)","AcceptorStateMachine.runTo (/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12)","/var/runtime/node_modules/aws-sdk/lib/state_machine.js:26:10","Request.&lt;anonymous&gt; (/var/runtime/node_modules/aws-sdk/lib/request.js:38:9)","Request.&lt;anonymous&gt; (/var/runtime/node_modules/aws-sdk/lib/request.js:685:12)","Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:115:18)"]}
  END RequestId: 7d76c52a-3c61-11e8-b415-093987d0d3bc
  REPORT RequestId: 7d76c52a-3c61-11e8-b415-093987d0d3bc  Duration: 215.36 ms Billed Duration: 300 ms     Memory Size: 512 MB Max Memory Used: 37 MB  
  </code></pre>
  
  <p>I have checked multiple documentation and web sites and they are all following the same code to do this, however I am not sure why it is not working for me:</p>
  
  <p><strong>Resources</strong>:</p>
  
  <p><a href="https://rishabh.io/misc/dynamodb-with-nodejs.html" rel="nofollow noreferrer">https://rishabh.io/misc/dynamodb-with-nodejs.html</a>
  <a href="https://medium.com/quick-code/node-js-restful-api-with-dynamodb-local-7e342a934a24" rel="nofollow noreferrer">https://medium.com/quick-code/node-js-restful-api-with-dynamodb-local-7e342a934a24</a></p>
  
  <p><strong>Note: --- TABLE DETAILS ----</strong></p>
  
  <pre><code>Table name  simul-MOCK_LEADS_TBL
  Primary partition key   lead_email (String)
  Primary sort key    lead_id (String)
  Point-in-time recovery  DISABLEDEnable
  Encryption  DISABLED
  Time to live attribute  DISABLEDManage TTL
  Table status    Active
  Creation date   April 6, 2018 at 12:19:00 PM UTC-7
  UTC: April 6, 2018 at 7:19:00 PM UTC
  
  Local: April 6, 2018 at 12:19:00 PM UTC-7
  
  Region (Oregon): April 6, 2018 at 11:19:00 AM UTC-8
  
  Provisioned read capacity units 5 (Auto Scaling Enabled)
  Provisioned write capacity units    5 (Auto Scaling Enabled)
  Last decrease time  -
  Last increase time  -
  Storage size (in bytes) 34.22 KB
  Item count  107
  Region  US West (Oregon) 
  </code></pre>