GetItem by date in DynamoDB results in ValidationException

I need a data filtered by date but I am getting an error

Error ValidationException: The provided key element does not match the schema

My table has a primary key (only partition key) of id.

async function fetchDatafromDatabase() {  // get method fetch data from dynamodb
    var date = todayDate();
    var params = {
        TableName: table,
        Key: {
            "date": date

    let queryExecute = new Promise((res, rej) => {
        dynamoDB.get(params, function (err, data) {
            if (err) {
                console.log("Error", err);
            } else {
                console.log("Success! get method fetch data from dynamodb");
                res(JSON.stringify(data, null, 2));
    const result = await queryExecute;

17 thoughts on “GetItem by date in DynamoDB results in ValidationException”

Leave a Comment