AWS IoT - Dynamo Insert记录失败

时间:2016-12-16 14:58:36

标签: amazon-web-services iot

我正在尝试更新DynamoDB并从Rasperry PI或MQTT Client发送JSON数据,但是当我查看CloudWatch时,我会看到以下错误消息。

EVENT:DynamoActionFailure TOPICNAME:iotbutton / test CLIENTID:MQTT_FX_Client MESSAGE:Dynamo Insert记录失败。收到的错误是属性名称不能为null或为空。消息到达:iotbutton / test,Action:dynamo,Table:myTable_IoT,HashKeyField:SerialNumber,HashKeyValue:ABCDEFG12345,RangeKeyField:Some(ClickType),RangeKeyValue:SINGLE

我正在使用AWS IoT教程(http://docs.aws.amazon.com/iot/latest/developerguide/iot-dg.pdf),Seccion:创建DynamoDB规则。

我发送给物联网平台的数据是:

np.random.seed(123)
N = 1000000

L2 = list('abcde')

df = pd.DataFrame({'b':np.random.randint(20, size=N), 
                   'a': np.random.choice(L2, N)})

print (df)


In [25]: %timeit df.groupby('a')['b'].apply(lambda x: x.nlargest(3).sum())
10 loops, best of 3: 82 ms per loop

In [26]: %timeit df.groupby('a')['b'].nlargest(3).groupby(level='a').sum()
10 loops, best of 3: 81.9 ms per loop

In [33]: %timeit df.groupby('a')['b'].nlargest(3).sum(level=0)
10 loops, best of 3: 82.5 ms per loop

主题: iotbutton / ABCDEFG12345

是否有人遇到此错误并了解任何解决方案?

谢谢,问候。

1 个答案:

答案 0 :(得分:1)

这是尝试执行此操作时CloudWatch日志显示的消息:

{ 
  "timestamp": "2019-01-28 21:26:16.363", 
  "logLevel": "ERROR", 
  "traceId": "9e3ff9b0-fcdf-d8ae-e8a8-4b7a24902405", 
  "accountId": "xxx", 
  "status": "Failure", 
  "eventType": "RuleExecution", 
  "clientId": "basicPubSub", 
  "topicName": "xxx/r117", 
  "ruleName": "devCompDynamoDB", 
  "ruleAction": "DynamoAction", 
  "resources": 
  { 
    "ItemRangeKeyValue": "SINGLE", 
    "IsPayloadJSON": "true", 
    "ItemHashKeyField": "SerialNumber", 
    "Operation": "Insert", 
    "ItemRangeKeyField": "ClickType", 
    "Table": "TestIoTDataTable", 
    "ItemHashKeyValue": "ABCDEFG12345" 
  }, 
  "principalId": "xx", 
  "details": "Attribute name must not be null or empty" 
}

要解决此问题,我在IoT Web控制台中编辑了DynamoDB规则,并在“将消息数据写入此列”字段中添加了有效负载列。

Example Image