Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.2k views
in Technique[技术] by (71.8m points)

IoT Edge runtime error 400 after starting VM which was off for 1+ months

I had a working VM running IoT Edge 1.0.10.3 on Ubuntu 16.04 that I had turned off for the past month or so.

Turned it on today to find that:

  • I can start up all modules ok. They all report running
  • The runtime response is: 400 -- The deployment configuration is malformed or invalid
  • Running iotedge check, it doesn't appear that there's any errors
  • when I try to set modules, under IoT edge Modules: There are no listed IoT Edge Modules
  • also I'm getting the following error in the EdgeHub logs:
<4> 2021-01-19 22:27:12.834 +00:00 [WRN] - Error getting edge hub config from twin desired properties
System.ArgumentException: schemaVersion is null or whitespace.
   at Microsoft.Azure.Devices.Edge.Util.Preconditions.CheckArgument(Boolean expression, String message) in /home/vsts/work/1/s/edge-util/src/Microsoft.Azure.Devices.Edge.Util/Preconditions.cs:line 73
   at Microsoft.Azure.Devices.Edge.Util.Preconditions.CheckNonWhiteSpace(String value, String paramName) in /home/vsts/work/1/s/edge-util/src/Microsoft.Azure.Devices.Edge.Util/Preconditions.cs:line 192
   at Microsoft.Azure.Devices.Edge.Hub.Core.Config.EdgeHubDesiredProperties..ctor(String schemaVersion, IDictionary`2 routes, StoreAndForwardConfiguration storeAndForwardConfiguration) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/config/EdgeHubDesiredProperties.cs:line 14
   at lambda_method(Closure , Object[] )
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
   at Microsoft.Azure.Devices.Edge.Hub.Core.Config.TwinConfigSource.GetConfigInternal() in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/config/TwinConfigSource.cs:line 97
   at Microsoft.Azure.Devices.Edge.Hub.Core.Config.TwinConfigSource.GetConfigInternal() in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/config/TwinConfigSource.cs:line 105

What could have happened in the past month of being offline to put the edge into an inconsistent state?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

According to the docs, the $schemaVersion that your logs refer to was introduced in 1.0.10. The docs say the property is recommended, but it would seem the runtime requires it. In your comment you included the desired properties, which is missing the $schemaVersion. Try setting the following desired properties:

"properties":{
  "desired":{
     "routes":{},
     "schemaVersion": "1.1",
     "$metadata":{
        "$lastUpdated":"2020-11-25T18:26:39.4780665Z",
        "$lastUpdatedVersion":5,
        "routes":{
           "$lastUpdated":"2020-11-25T15:03:42.6671499Z",
           "$lastUpdatedVersion":4
        }
     }
  }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.6k users

...