I am trying to run DAX sample getitem-test.js as a lambda.(doc link).I modified code to read from daxclient which I created. But daxClient.get returns error from lambda
START RequestId: bb657a02-05b1-11e8-804d-a1d27ac0e9f7 Version: $LATEST 2018-01-30T11:36:03.363Z bb657a02-05b1-11e8-804d-a1d27ac0e9f7 Unable to read item. Error JSON: { "time": 1517312163361, "code": "ValidationException", "retryable": true, "requestId": "AVI5QK8LN9S41B64JTTJVECLR3VV4KQNSO5AEMVJF66Q9ASUAAJG", "statusCode": "400", "_tubeInvalid": false, "waitForRecoveryBeforeRetrying": false }
I have setup dynamo db tables using dynamodbclient. setup VPC, subnets etc.. But I have no luck reading data from DAX. Any idea what could be the issue.
Following is the code I used:
var region = "eu-west-1";
AWS.config.update({
region: region
});
var daxClient = null;
var dax = new AmazonDaxClient({ endpoints: ["mydax.e02jim.clustercfg.dax.euw1.cache.amazonaws.com:8111"], region: region })
daxClient = new AWS.DynamoDB.DocumentClient({ service: dax });
var tableName = "TryDaxTable";
var params = {
TableName: tableName,
Key: {
"pk": 7,
"sk": 1
}
};
daxClient.get(params, function (err, data) {
if (err) {
console.error("Unable to read item. Error JSON:",
JSON.stringify(err, null, 2));
} else {
console.log("success");
}
});
I can get the result using var ddbClient = new AWS.DynamoDB.DocumentClient()
instead of daxClient
.
Also my lambda function is timed out