【以下的问题经过翻译处理】 我正在使用Lambda查询事项,我的问题是:
const now = new Date();
const isoString = now.toISOString();
const params = {
TableName: 'Todo-xxxxxxxxxxxxxxxxxxxx-dev',
IndexName: 'title-createdAt-index',
"Limit": 10,
KeyConditionExpression: '#title =:value and #createdAt BETWEEN :start AND :end',
ExpressionAttributeValues: { ':value': "hi",
':start':'2022-06-16T03:47:35.343Z',
':end': isoString },
ExpressionAttributeNames: { '#title': 'title',
'#createdAt':'createdAt'
}
};
这个代码很好用,但当我更改ExpressionAttributeValues的值,例如将':value':
改为hii
时,我会遇到错误。
当我将':end': isoString
更改为':end': '2022-07-21T10:49:47.720Z'
或':start':'2022-06-16T03:47:35.343Z'
更改为':start':'2022-07-21T10:49:47.720Z'
时,我会遇到错误:
{
"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:85:29)",
" at processTicksAndRejections (node:internal/process/task_queues:96:5)"
]
}
链接:演示错误