Open vijay9561 opened 1 year ago
I am going to assume you have properly set up your credentials in your AWS environment and that you have imported the right AWS SDK libraries. At first glance, I can see you have a typo on your params
const, it should include the word Keys
not Key
:
const params = {
RequestItems: {
'eos-dev-Customer-Vehicles': {
Keys: keyMap,
}
}
};
In your example, you are not sending params
to the batch get item operation, you are sending keyMap
and that JSON does not have the required parameters. I suggest you fix the typo and send the right variable to the batchGet
method and let me know the results.
After Adding the Keys instead of key. But still getting the same error
const keyMap = await custIDs.map((element: any) => { return { customerId: element.mergeCustId.toString(), vehicleId: element.mergeCustId.toString() }; }); console.log("keyMap", JSON.stringify(keyMap)); const params = { RequestItems: { 'eos-dev-Customer-Vehicles': { Keys: keyMap, } } }; console.log("params", JSON.stringify(params)); return docClient.batchGet(keyMap, (err: any, data: any) => { if (err) { console.log("err", err); } else { console.log("data", data); } });
Hi Team, I have trying to get batch of record. But I'm unable to fetch the record and getting the below error and code. Please help on that issue.
My Below code import AWS, { DynamoDB } from 'aws-sdk'; const docClient = new AWS.DynamoDB.DocumentClient();
Error:
2023-07-11T10:39:32.993Z a89ddd1c-c372-468c-a9d2-a91173ab9a82 INFO err MissingRequiredParameter: Missing required key 'RequestItems' in params at ParamValidator.fail (/var/task/output/purge-merge-automation/index.js:22005:37) at ParamValidator.validateStructure (/var/task/output/purge-merge-automation/index.js:22016:14) at ParamValidator.validateMember (/var/task/output/purge-merge-automation/index.js:22043:21) at ParamValidator.validate (/var/task/output/purge-merge-automation/index.js:21989:10) at Request.VALIDATE_PARAMETERS (/var/task/output/purge-merge-automation/index.js:19767:42) at Request.callListeners (/var/task/output/purge-merge-automation/index.js:25757:20) at callNextListener (/var/task/output/purge-merge-automation/index.js:25747:12) at /var/task/output/purge-merge-automation/index.js:19721:9 at finish (/var/task/output/purge-merge-automation/index.js:14369:7) at /var/task/output/purge-merge-automation/index.js:14387:9 at EnvironmentCredentials.get (/var/task/output/purge-merge-automation/index.js:14925:7) at getAsyncCredentials (/var/task/output/purge-merge-automation/index.js:14381:24) at Config.getCredentials (/var/task/output/purge-merge-automation/index.js:14401:9) at Request.VALIDATE_CREDENTIALS (/var/task/output/purge-merge-automation/index.js:19716:26) at Request.callListeners (/var/task/output/purge-merge-automation/index.js:25753:18) at Request.emit (/var/task/output/purge-merge-automation/index.js:25729:10) { code: 'MissingRequiredParameter', time: 2023-07-11T10:39:32.990Z }