Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

135
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda