Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

133
Views
BatchGetItem returning successful but null

Trying to run a BatchGetItem from Lambda to DynamoDB however When I run the query it returns a null response and logs no issues. PK (Primary Key) and SK (Sort Key) do exist in the table and the values associated with each are currently stored in the table as seen below. The Lambda function has permissions to run BatchGetItem on that specific table and when I run a single GetItem on that same table it works fine and returns a single item. Any help with trying to get BatchGetItem to return the queried items would be greatly appreciated. Thanks

DynamoDB Image

DynamoDB Attributes

Lambda Code

// Load the AWS SDK for Node.js
var AWS = require('aws-sdk');
// Set the region 
AWS.config.update({region: 'us-east-1'});

// Create DynamoDB service object
var ddb = new AWS.DynamoDB({apiVersion: '2012-08-10'});

var info;

exports.handler = async (event, context) => {
  var params = {
    RequestItems: {
      "candidates": {
        Keys: [
          {
            "PK": {S: "jack"},
            "SK": {S: "C108951642"}
          },
          {
            "PK": {S: "ben"},
            "SK": {S: "C143956179"}
          },
          {
            "PK": {S: "hill"},
            "SK": {S: "C268283233"}
          }
        ],
        ProjectionExpression: "Name"
      }
    }
  };
  
  ddb.batchGetItem(params, function(err, data) {
    if (err) {
      console.log("Error", err);
    } else {
      data.Responses.TABLE_NAME.forEach(function(element, index, array) {
        console.log(element);
        info = element;
      });
    }
  });
  return info;
}

Lambda Response

Test Event Name
batch

Response
null

Function Logs
START RequestId: a411114a-29b9-4f7f-bc20-2a5caff9f0cf Version: $LATEST
END RequestId: a411114a-29b9-4f7f-bc20-2a5caff9f0cf
REPORT RequestId: a411114a-29b9-4f7f-bc20-2a5caff9f0cf  Duration: 442.11 ms Billed Duration: 443 ms Memory Size: 128 MB Max Memory Used: 78 MB

Request ID
a411114a-29b9-4f7f-bc20-2a5caff9f0cf
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!