AWS - One of the required keys was not given a value
<p>New to AWS, trying to put data into a table. After reading the documentation and trying to follow examples I am running into this validation error.</p>

<pre><code>One of the required keys was not given a value
</code></pre>

<p>My code:</p>

<pre><code>var conf = require("/directory");
var AccessKey = 'supersecretkey';
var SecretKey = 'supersecretkey';

var tableName = conf.tableCS;

var AWS = require('aws-sdk');

console.log("Endpoint: " + conf.endpoint);
AWS.config.update({
    accessKeyId: AccessKey,
    secretAccessKey: SecretKey,
    region: conf.region,
    endpoint: conf.endpoint
});
var docClient = new AWS.DynamoDB.DocumentClient();

var file = process.argv[2];
console.log("File: " + file);

var csv = require("fast-csv");

csv.fromPath(file)
    .on("data", function(data) {
        // Uncomment to see CSV data
        // console.log(data);

        var arrayLength = data.length;
        for (var i = 0; i &lt; arrayLength; i++) {
            // console.log(data[i]);
            var params = {
                TableName: tableName,
                Key: {
                       RefID: data
                }
            };

            console.log("Adding a new item...");
            docClient.put(params, function(err, data) {
                if (err) {
                    console.error("Unable to add item. Error JSON:", JSON.stringify(err, null, 2));
                }
                else {
                    console.log("Added item:", JSON.stringify(data, null, 2));
                }
            });
            // Looping through, now putItem into database
        }

    })
    .on("end", function() {
        console.log("done");
    });
</code></pre>

<p>I found <a href="https://stackoverflow.com/questions/37564832/can-dynamodb-range-key-be-empty">this</a>, but am not understanding the <code>range</code> key part. I'm creating the table in this following code and have the <code>hash</code> key, but not a <code>range</code> key. Is that my issue? What would I make the range key?</p>

<pre><code>var conf = require("/directory");
var AccessKey = 'supersecretkey';
var SecretKey = 'supersecretkey';

var tableName = conf.tableCSV;

// Take input from command line
process.argv.forEach(function(val, index, array) {
    console.log(index + ': ' + val);
});

console.log("Table: " + tableName);

var AWS = require('aws-sdk');

console.log("Endpoint: " + conf.endpoint);
AWS.config.update({
    accessKeyId: AccessKey,
    secretAccessKey: SecretKey,
    region: conf.region,
    endpoint: conf.endpoint
});
var dynamodb = new AWS.DynamoDB();

var params = {
    TableName: tableName,
    KeySchema: [{
        AttributeName: 'RefID',
        KeyType: 'HASH'
    }],
    AttributeDefinitions: [{
        AttributeName: 'RefID',
        AttributeType: 'S'
    }],
    ProvisionedThroughput: {
        ReadCapacityUnits: 1,
        WriteCapacityUnits: 1
    }
};

dynamodb.createTable(params, function(err, table) {
    if (err) {
        console.log(err);
    }
    else {
        console.log("TABLED CREATED");
        console.log(table);
    }
});
</code></pre>