我試圖使用aws-sdk
與AWS的dynamodb與DynamoDB和putItem
這裏互動AWS SDK的問題是我的代碼:
DynamoDB.putItem({
"TableName": tblName,
"Item": {
"UserId": { "N": obj.user_id.toString() },
"Identifier": { "S": obj.identifier },
"ReferralToken": { "S": obj.referral_token },
"CampaignId": { "N": obj.campaign_id.toString() },
"FirstName": { "S": obj.first_name },
"LastName": { "S": obj.last_name },
"Gender": { "S": obj.gender },
"BirthDate": { "S": obj.birthdate },
"Username": { "S": obj.username },
"MobileNumber": { "S": obj.mobile_number },
"PostalCodeText": { "S": obj.postal_code_text },
"Classification": { "S": obj.classification },
"DeliveryEmail": { "S": obj.delivery_email.toString() },
"DeliverySMS": { "S": obj.delivery_sms.toString() }
}
}, function (err, data) {
console.log(err);
console.log(data);
});
我收到的錯誤是
{ [ValidationException: Supplied AttributeValue is empty, must contain exactly one of the supported datatypes]
message: 'Supplied AttributeValue is empty, must contain exactly one of the supported datatypes',
code: 'ValidationException',
time: Fri Oct 10 2014 10:15:25 GMT-0500 (CDT),
statusCode: 400,
retryable: false }
不知道我在做什麼錯
錯誤說,提供的屬性是空的,你能檢查所有來自「obj」的值是否爲空。 – 2014-10-11 05:40:24