javascript – AWS Lambda returning empty result queryCommand dynamodb

I am trying to implement a simple QueryCommand using the new javascript v3, as the sample here:
github.com/awsdocs/aws-doc-sdk-examples/blob/main/javascriptv3/example_code/dynamodb/actions/document-client/query.js
when I try the following code, I get a 200 answer without any results: (I am using QueryCommand from “@aws-sdk/lib-dynamodb”;

    const command = new QueryCommand({
    TableName: 'my-table',
    KeyConditionExpression:
      'pk = :mydata',
    ExpressionAttributeValues: {
      ":myData": "Blah",
    },
    ConsistentRead: true,
  });
console.log(command);
  const response = await docClient.send(command);
console.log(response);

return response.Items

this code returns 200 but without any items.
that is the logged query:

{"middlewareStack":{},"input":{"TableName":"my-table","KeyConditionExpression":"pk = :mydata","ExpressionAttributeValues":{":mydata":"Blah"},"ConsistentRead":true},"inputKeyNodes":{"KeyConditions":{"":{"AttributeValueList":[]}},"QueryFilter":{"":{"AttributeValueList":[]}},"ExclusiveStartKey":{},"ExpressionAttributeValues":{}},"outputKeyNodes":{"Items":{"*":{}},"LastEvaluatedKey":{}},"clientCommand":{"middlewareStack":{},"input":{"TableName":"my-table","KeyConditionExpression":"pk = :mydata","ExpressionAttributeValues":{":mydata":"Blah"},"ConsistentRead":true}}},"logStream":"$LATEST","requestId":"8fa0b0ee-4fda-4b49-b40e-083c8a2c46ee","version":"$LATEST","mydata":"Blah"}

and here is the logged response:

{"$metadata":{"httpStatusCode":200,"requestId":"20c448cf-28a4-4c99-b7fe-7a3e296e7388","attempts":1,"totalRetryDelay":0}},"logStream":"$LATEST","requestId":"8fa0b0ee-4fda-4b49-b40e-083c8a2c46ee","version":"$LATEST","mydata":"Blah"}

when I try to run the following query in the terminal:

aws dynamodb query --table-name my-table --key-condition-expression "pk = :mydata" --expression-atribute-values '{":mydata":{"S":"Blah"}' --endpoint-url http://localhost:8000

it returns 3 values. I can’t find what I am missing here. ideas?

here is the data on AWS DynamoDBDynamoDB query

Read more here: Source link