DAX put Item 失败 "Cannot convert undefined or null to object"
DAX put Item fails with "Cannot convert undefined or null to object"
我正在尝试为现有的 Lambda 函数配置 DAX,该函数将数据读取和写入 DynamoDB。在引入 DAX 之前一切正常,之后,写入停止工作,写入的数据没有变化。
在调试时,我发现它们因以下异常而失败:
Write operation failed without negative acknowledgement
Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at Function._encodeAttributeValueInternal (/var/task/node_modules/amazon-dax-client/src/AttributeValueEncoder.js:173:23)
at Function.encodeAttributes (/var/task/node_modules/amazon-dax-client/src/AttributeValueEncoder.js:144:29)
at Function.encodeValuesWithNames (/var/task/node_modules/amazon-dax-client/src/Encoders.js:227:55)
at Encoders.encodeValues (/var/task/node_modules/amazon-dax-client/src/Encoders.js:67:23)
at Promise.resolve.then (/var/task/node_modules/amazon-dax-client/generated-src/Stubs.js:163:24)
at propagateAslWrapper (/var/task/node_modules/async-listener/index.js:504:23)
at /var/task/node_modules/async-listener/glue.js:188:31
at /var/task/node_modules/async-listener/index.js:541:70
at /var/task/node_modules/async-listener/glue.js:188:31
正在写入的数据有一些字段是 "optional"。正在编写的项目如下:
{
requiredField1: "Some value",
requiredField2: true,
optionalField1: "abc",
optionalField2: null,
optionalField3: undefined,
}
DynamoDB 一切都很好,很花花公子,没有抱怨,但显然 DAX 对 undefined
是无情的。将其更改为 null
让我克服了错误。
我正在尝试为现有的 Lambda 函数配置 DAX,该函数将数据读取和写入 DynamoDB。在引入 DAX 之前一切正常,之后,写入停止工作,写入的数据没有变化。
在调试时,我发现它们因以下异常而失败:
Write operation failed without negative acknowledgement
Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at Function._encodeAttributeValueInternal (/var/task/node_modules/amazon-dax-client/src/AttributeValueEncoder.js:173:23)
at Function.encodeAttributes (/var/task/node_modules/amazon-dax-client/src/AttributeValueEncoder.js:144:29)
at Function.encodeValuesWithNames (/var/task/node_modules/amazon-dax-client/src/Encoders.js:227:55)
at Encoders.encodeValues (/var/task/node_modules/amazon-dax-client/src/Encoders.js:67:23)
at Promise.resolve.then (/var/task/node_modules/amazon-dax-client/generated-src/Stubs.js:163:24)
at propagateAslWrapper (/var/task/node_modules/async-listener/index.js:504:23)
at /var/task/node_modules/async-listener/glue.js:188:31
at /var/task/node_modules/async-listener/index.js:541:70
at /var/task/node_modules/async-listener/glue.js:188:31
正在写入的数据有一些字段是 "optional"。正在编写的项目如下:
{
requiredField1: "Some value",
requiredField2: true,
optionalField1: "abc",
optionalField2: null,
optionalField3: undefined,
}
DynamoDB 一切都很好,很花花公子,没有抱怨,但显然 DAX 对 undefined
是无情的。将其更改为 null
让我克服了错误。