I tried to insert one data into Dynamodb using batchWrite though, it couldn't insert data. It just shows this message (but no error message).
Ensuring latest function changes are built...
Starting execution...
{"key1":"value1","key2":"value2","key3":"value3"}
Result:
null
Finished execution.
Then, cannot insert data.
I tried to use put tho, it worked well.
I'm using Lambda. This is the code.
const dynamodb = new AWS.DynamoDB.DocumentClient();
let tableName = "BlrSession-56pfbzohnvdqpac6asb627z2wu-dev";
// const AWS = require("aws-sdk/global");
exports.handler = (event, context, callback) => {
// The event parameter is the input to your lambda function
console.log(JSON.stringify(event));
let games = [];
let documentClient = new AWS.DynamoDB.DocumentClient();
// lambda.forEach((item) => {
games.push({
PutRequest: {
Item: {
id: Math.random().toString(36).substring(2) + Date.now().toString(36),
},
},
});
// });
let params = {
RequestItems: {
tableName: games,
},
};
documentClient.batchWrite(params, function (err, data) {
if (err) {
callback(err);
} else {
callback(null, data);
}
});
};
it cannot insert data.?