title: ValidationException: ExpressionAttributeValues contains invalid key
body: <p>I'm trying to filter the results of a scan of a DynamoDB table using a FilterExpression in my query. I'm using a Lambda function deployed on API Gateway on AWS.</p>
  <p><strong>Function Querying the Endpoint</strong></p>
  <pre><code>// Scan the table for entries and use data to populate HTML table.
  async function scanTable(){
    
      var query = {
          TableName: &quot;bookings&quot;,
          ProjectionExpression: &quot;id, username, start_booking, end_booking&quot;,
          FilterExpression: &quot;username = :u&quot;,
          ExpressionAttributeValues: {&quot;:u&quot;:&quot;human@gmail.com&quot;}
      };
  
      try{      
          const response = await axios({ method: 'get', url: `${url}/bookings`, params: query });    
      }catch(err){
          console.log(err);
      }
  }
  </code></pre>
  <p><strong>Lambda Function</strong></p>
  <pre><code>'use strict'
  const AWS = require('aws-sdk');
  
  
  exports.handler = async (event, context) =&gt; {
      const documentClient = new AWS.DynamoDB.DocumentClient({convertEmptyValues: true});
  
      let responseBody = &quot;&quot;;
      let statusCode = 0;
  
      const params = (event.queryStringParameters);
      // console.log(params);
      
      try{
          const data = await documentClient.scan(params).promise();
          responseBody = JSON.stringify(data.Items);
          statusCode = 200;
      }catch(err){
          responseBody = `Unable to get the bookings: ${err}`;
          statusCode = 403;
      }
      
      console.log(&quot;Response Body: &quot; + responseBody);
  
      const response = {
          statusCode: statusCode,
          headers: {
              &quot;Content-Type&quot;: &quot;application/json&quot;,
              &quot;Access-Control-Allow-Origin&quot;: &quot;*&quot;
          },
          body: responseBody
      };
      
      
  
      return response;
  }
  </code></pre>
  <p>The complete error I receive is</p>
  <p><code>ValidationException: ExpressionAttributeValues contains invalid key: Syntax error; key: &quot;11&quot;</code></p>
  <p>where the key value at the end of the error (key:&quot;11&quot;) changes somewhat dependent on the value assigned in ExpressionAttributeValues. I've tried to follow the FilterExpression example in the <a href="https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#scan-property" rel="nofollow noreferrer">DynamoDB Docs for the scan function</a> to no avail. Here is another <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStarted.NodeJs.04.html#GettingStarted.NodeJs.04.Scan" rel="nofollow noreferrer">example</a>.</p>
  <p><a href="https://forums.aws.amazon.com/thread.jspa?messageID=870941&amp;#870941" rel="nofollow noreferrer">Here</a> is a similar question from the AWS forums.</p>