title: How to get AWS JavaScript SDK and DynamoDB working with LocalStack
body: <p>We are using LocalStack and having issues interacting with DynamoDB using the AWS js SDK. We are getting an &quot;UnknownError&quot; when trying to use the putItem method of the DynamoDB instance. Here is the error output:</p>
  <pre><code>{
      “name”: “DynamoDbError”,
      “data”: {
          “dynamoDbPutObjectParameters”: {
              “TableName”: “fooTableName”,
              “Item”: {
                  “hello”: {
                      “S”: “world”
                  }
              }
          }
      },
      “baseError”: {
          “message”: null,
          “code”: “UnknownError”,
          “time”: “2020-11-23T11:40:26.382Z”,
          “statusCode”: 500,
          “retryable”: true
      }
  }
  </code></pre>
  <p>We have set the endpoint in the DynamoDB instance options to be:</p>
  <pre><code>http://localhost:4566
  </code></pre>
  <p>4566 is the Edge port we have set for the DynamoDB service in LocalStack.</p>
  <p>We get validation errors from the SDK if our put object parameters are incorrect BUT these parameters seem to be okay. They DO work on AWS proper when deployed and the table does update.</p>
  <p>We have deployed the DynamoDB tables locally using the AWS CDK and aws-cdk-local and WE CAN query, put and update the table in LocalStack using the AWS CLI successfully.</p>
  <p>The issue seems to be using the AWS js SDK to interact with the DynamoDB in LocalStack.</p>
  <p>Here is the call to putItem which works on AWS but not with LocalStack via the AWS SDK:</p>
  <pre><code>putItem: async (
          dynamoDbPutObjectParameters
      ) =&gt; {       
          try {
              const data = await dynamoDbInstance.putItem(dynamoDbPutObjectParameters).promise();
              return data;
          } catch (error) {
              throw new DynamoDbError('Failed to put data to DynamoDB', {
                  data: { dynamoDbPutObjectParameters },
                  baseError: error
              });
          }
      },
  </code></pre>
  <p>Does anyone have any ideas what might be going on or how to progress?</p>
  <p>Thanks</p>