title: API Gateway error (ValidationException: ExpressionAttributeValues must not be empty) when trying to update DynamoDB entry
body: <p>I am new to AWS and am trying to set up the back end for my buddy's website.  I am able to 'get' entries from my database (called 'isThrowingTable') but am unable to 'put' updates into it.  I run a Request Body as seen in the picture/code below and I get a response body (error) as seen in the pic/code (see the lambda function line 28 to see how that response is created, I added stuff to debug it)</p>
  <p><a href="https://i.stack.imgur.com/eCHOv.png" rel="nofollow noreferrer">API Gateway 'Request Body' 'Resources' and 'ErrorMessage' </a></p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>ERROR: ValidationException: ExpressionAttributeValues must not be empty Unable to put product: event.body {
      "dataName": "throwingStatus",
      "updatedInfo": false
  } into params {"TableName":"isThrowingTable","Key":{},"UpdateExpression":"set info = :info","ExpressionAttributeValues":{},"ReturnValues":"UPDATED_NEW"} dataName: undefined updatedInfo undefined</code></pre>
  </div>
  </div>
  </p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>{
      "dataName": "throwingStatus",
      "updatedInfo": false
  }</code></pre>
  </div>
  </div>
  </p>
  <p>This is the lambda that is kicked off from the Gateway Test</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>'use strict';
  const AWS = require('aws-sdk');
  const documentClient = new AWS.DynamoDB.DocumentClient();
  
  exports.handler = async (event, context) =&gt; {
    let responseBody = "";
    let statusCode = 0;
    
    //const { dataName, updatedInfo } = JSON.parse((event.body)); //SyntaxError: Unexpected token in JSON at position 1
      const dataName = event.body.dataName
      const updatedInfo = event.body.updatedInfo
     var params = {
      TableName: "isThrowingTable",
      Key: {
        id: dataName
      },
      UpdateExpression: "set info = :info",
      ExpressionAttributeValues: {
          ":info": updatedInfo
      },
      ReturnValues: "UPDATED_NEW"
    };
  
    try {
      const data = await documentClient.update(params).promise();
      responseBody = JSON.stringify(data);
      statusCode = 201;
    } catch(err) {
      responseBody = `ERROR: ${err} Unable to put product: event.body ${event.body} into params ${JSON.stringify(params)} dataName: ${dataName} updatedInfo ${updatedInfo}`;
      statusCode = 403;
    }
  
    return {
      statusCode: statusCode,
      headers: {
        "Content-Type": "application/json",
        "access-control-allow-origin": "*"
      },
      body: responseBody
    };
  };</code></pre>
  </div>
  </div>
  </p>
  <p>As you can see in the error message, params.Key and params.ExpressionAttributeValues are not set and I'm not sure why.  In the print out of event.body you can see dataName (the id of the item in the database) and updatedInfo are present but trying to grab it results in 'undefined'.  I am hoping for a fix and also to learn why this is happening.</p>