AWS Dynamodb scan using ExclusiveStartKey option
<p>For my recent project, I am trying to get data from dynamodb. And it seems everything working fine except I add &quot;exclusiveStartKey&quot; option to my parameters.</p>
<p>Below is my code.</p>
<pre><code>function scanDataFromDB(datetime) {
let params = {
    TableName: TABLE_NAME,
    IndexName: &quot;main-index&quot;,
    Select: &quot;ALL_ATTRIBUTES&quot;,
    ExclusiveStartKey: {
        &quot;message_id&quot;: { &quot;S&quot;: &quot;20161011175258875925351560&quot;}
    },
    ExpressionAttributeNames: {
        &quot;#f_up&quot;: &quot;date_updated&quot;
    },
    ExpressionAttributeValues: {
        &quot;:s_time&quot;: &quot;2016-10-11 00:00:00&quot;,
        &quot;:e_time&quot;: &quot;2016-10-11 23:59:59&quot;
    },
    FilterExpression: &quot;#f_up between :s_time and :e_time&quot;,
    ScanIndexForward: &quot;true&quot;
};
console.log(params);
docClient.scan(params, function(err, data) {
    if(err) {
        console.log(JSON.stringify(err, null, 2));
        //callback(err, null);
    } else {
        console.log(JSON.stringify(data, null, 2));
        //callback(null, err);
    }
})
}
</code></pre>
<p>This keep returning &quot;The provided starting key is invalid.&quot;</p>