title: DynamoDB query with Lambda (node.js): Query key condition not supported
body: <p>I try to query my dynamoDB from a Lambda function. My table uses "id" as the hash key. I tried both versions below and received the corresponding error messages. What am I doing wrong?</p>
  
  <pre><code>  var params = {
          TableName : "addresses",
          KeyConditionExpression: "id = :id AND city = :city",
          ExpressionAttributeValues: {
              ":id": "Austria",
              ":city": "Salzburg"
          }
      };
  </code></pre>
  
  <p>Unable to query. Error: {
    "message": "Query key condition not supported",...}</p>
  
  <pre><code>var params = {
      TableName : "addresses",
      KeyConditionExpression: "city = :city",
      ExpressionAttributeValues: {
          ":city": "Salzburg"
      }
  };
  </code></pre>
  
  <p>Unable to query. Error: {
    "message": "Query condition missed key schema element: id",...}</p>
  
  <p>EDIT:</p>
  
  <p>I now added secondary indices, but still get the same errors:</p>
  
  <p><a href="https://i.stack.imgur.com/Pncsa.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/Pncsa.jpg" alt="enter image description here"></a></p>