aws/aws-iot-device-sdk-cpp

Missing required node: state error on shadow update

shekharhimanshu opened this issue · 0 comments

Hello,

I am getting {"code":400,"message":"Missing required node: state","clientToken":"myToken_1567755983878044160"} in the given scenario:

Lets say we have Device1 which reports its state and Device2 which desires state for Device1.

  • Device1 initially reports state, {"color":"red"}
  • Then Device2 desires state, {"color":"blue"}
  • Then Device1 reports state, {"color":"red"} (ignoring the desired state)

In this case, shadow update gets rejected with the above error.
After some digging around the code, I found that Shadow::PerformUpdateAsync() was incorrectly calculating the diff between server and device state leading to the actual shadow upload payload being just {"clientToken":"myToken_1567755983878044160"} and hence the error.