Querying a DynamoDB table gives "Cannot read properties of undefined (reading 'id')" by changing the ExpressionAttributeValues

-1

My query Params looks like this:

const params = {
  TableName: 'Todo-xxxxxxxxxxxxxxxxx-dev',
  IndexName: 'title-createdAt-index',
  KeyConditionExpression: '#title =:value',
  ExpressionAttributeValues: { ':value':  "hi", },
  ExpressionAttributeNames: { '#title': 'title', }
  
};

When I'm changing the ExpressionAttributeValues from hi to hii it is throwing an error:

{
  "errorType": "TypeError",
  "errorMessage": "Cannot read properties of undefined (reading 'id')",
  "trace": [
    "TypeError: Cannot read properties of undefined (reading 'id')",
    "    at Runtime.exports.handler (/var/task/index.js:76:29)",
    "    at processTicksAndRejections (node:internal/process/task_queues:96:5)"
  ]
}

It is only working for hi and h if I put any value like abc,xyz it is giving above error.

  • Please provide the entire code snippet, what you have shared is not enough to help.

No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions