-1

I what to get items by query command with local index, but response is empty.

My code:

  const client = new DynamoDBClient({});
  const input = {
    TableName: "...",
    IndexName: "LITimestamp",
    KeyConditionExpression: 'PK = account#225873187286700#chat'
  }
  console.log(0, JSON.stringify(input));
  const command = new QueryCommand(input);
  let res;
  try {
    res = client.send(command);
  } catch(err) {
    console.log(1, JSON.stringify(err));
  }
  console.log(2, JSON.stringify(res));

DynamoDB console Logger

Can someone help me, I don't understand what is incorrect here

1 Answer 1

0

The send-command is async, so you'll have to await it:

try {
    res = await client.send(command);
} catch(err) {
    console.log(1, JSON.stringify(err));
}
console.log(2, JSON.stringify(res));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.