Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Crash on startup due to AWN JSON issue #29

Open
ShakataGaNai opened this issue Apr 6, 2024 · 0 comments
Open

[Bug] Crash on startup due to AWN JSON issue #29

ShakataGaNai opened this issue Apr 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ShakataGaNai
Copy link

Describe the bug
The application (in docker) crashes on startup due to unexpected JSON values coming from AWN

Logs as follows, slightly redacted. But any data change has been changed to different content but the same type (ex: DD GPS is still DD, just not the real numbers)

[21:32:02 ERR] Http Failed to deserialize response to target type: JSON
Flurl.Http.FlurlParsingException: Response could not be deserialized to JSON: GET https://rt.ambientweather.net/v1/devices?applicationKey=REDACTED&apiKey=REDACTED
 ---> Newtonsoft.Json.JsonSerializationException: Error converting value "Home" to type 'Core.AmbientWeatherNetwork.Dto.Location'. Path '[0].info.location', line 1, position 1215.
 ---> System.ArgumentException: Could not cast or convert from System.String to Core.AmbientWeatherNetwork.Dto.Location.
   at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
   at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   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.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   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.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
   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.JsonSerializer.Deserialize[T](JsonReader reader)
   at Flurl.Http.Configuration.NewtonsoftJsonSerializer.Deserialize[T](Stream stream)
   at Flurl.Http.FlurlResponse.GetJsonAsync[T]()
   --- End of inner exception stack trace ---
[21:32:02 INF] Response: OK - GET - https://rt.ambientweather.net/v1/devices?applicationKey=REDACTED&apiKey=REDACTED - Date: Sat, 06 Apr 2024 04:32:02 GMT
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: Express
Access-Control-Allow-Origin: *
Strict-Transport-Security: max-age=31536000; includeSubDomains
ETag: W/"5a9-yuxhqlwXLVuD1v3EYi1jNw"
Vary: Accept-Encoding
CF-Cache-Status: DYNAMIC
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=V1UcYJLjMAD5AjvXR2lwEfin2%2Bx3NRHoSnyQkpDuj3gdpAVeVhSpPEk9cQQswBY%2BOfkT2aaIb1ibu%2BPYDHNTocuvW6COxTAGnowJRQJeI2bsrVdqhVo2J3dsuDWreFM01dVHP5Hv%2Bg%3D%3D"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Server: cloudflare
CF-RAY: 86ff0d3dade315b0-SJC
 - [{"macAddress":"3C:REDACTED:A1","lastData":{"dateutc":1712377860000,"tempinf":66.9,"battin":1,"humidityin":48,"baromrelin":29.971,"baromabsin":29.971,"tempf":45.3,"battout":1,"humidity":86,"winddir":168,"winddir_avg10m":182,"windspeedmph":1.1,"windspdmph_avg10m":2.5,"windgustmph":3.4,"maxdailygust":5.8,"hourlyrainin":0,"eventrainin":0,"dailyrainin":0,"weeklyrainin":0.571,"monthlyrainin":0.571,"yearlyrainin":10.929,"solarradiation":0,"uv":0,"temp1f":65.7,"humidity1":49,"temp2f":62.1,"humidity2":53,"temp3f":56.8,"humidity3":44,"temp4f":65.1,"humidity4":46,"temp5f":63.9,"humidity5":47,"temp6f":56.8,"humidity6":45,"temp7f":67.1,"humidity7":47,"temp8f":46.8,"batt1":1,"batt2":1,"batt3":1,"batt4":1,"batt5":1,"batt6":1,"batt7":1,"batt8":1,"batt_co2":1,"feelsLike":45.3,"dewPoint":41.36,"feelsLike1":65.7,"dewPoint1":46,"feelsLike2":62.1,"dewPoint2":44.8,"feelsLike3":56.8,"dewPoint3":35.1,"feelsLike4":65.1,"dewPoint4":43.8,"feelsLike5":63.9,"dewPoint5":43.3,"feelsLike6":56.8,"dewPoint6":35.7,"feelsLike7":67.1,"dewPoint7":46.2,"feelsLikein":66.9,"dewPointin":46.6,"lastRain":"2024-04-05T23:50:00.000Z","tz":"America/Los_Angeles","date":"2024-04-06T04:31:00.000Z"},"info":{"name":"RawrCreek","location":"Home","coords":{"coords":{"lat":12.34567,"lon":-123.4567},"address":"123 Main St, BigCity, State, USA","location":"BigCity","elevation":27.59987640380859,"geo":{"type":"Point","coordinates":[-123.4567,12.34567]}}}}]
[21:32:02 ERR] AWN Background Collector error.
Flurl.Http.FlurlParsingException: Response could not be deserialized to JSON: GET https://rt.ambientweather.net/v1/devices?applicationKey=REDACTED&apiKey=REDACTED
 ---> Newtonsoft.Json.JsonSerializationException: Error converting value "Home" to type 'Core.AmbientWeatherNetwork.Dto.Location'. Path '[0].info.location', line 1, position 1215.
 ---> System.ArgumentException: Could not cast or convert from System.String to Core.AmbientWeatherNetwork.Dto.Location.
   at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
   at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   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.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   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.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
   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.JsonSerializer.Deserialize[T](JsonReader reader)
   at Flurl.Http.Configuration.NewtonsoftJsonSerializer.Deserialize[T](Stream stream)
   at Flurl.Http.FlurlResponse.GetJsonAsync[T]()
   --- End of inner exception stack trace ---
   at Flurl.Http.FlurlRequest.HandleExceptionAsync(FlurlCall call, Exception ex, CancellationToken token)
   at Flurl.Http.FlurlResponse.GetJsonAsync[T]()
   at Flurl.Http.ResponseExtensions.ReceiveJson[T](Task`1 response)
   at Core.AmbientWeatherNetwork.AWNBackgroundCollector.RunAsync(CancellationToken cancellationToken) in /build/src/Core/AmbientWeatherNetwork/AWNBackgroundCollector.cs:line 49
@ShakataGaNai ShakataGaNai added the bug Something isn't working label Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant