maxisoft / ASFFreeGames

Collect free steam games while asf is running
GNU Affero General Public License v3.0
122 stars 2 forks source link

Error when retrieving game list JSON data from reddit #28

Closed maxisoft closed 10 months ago

maxisoft commented 1 year ago

The plugin gets an error :x: sometime when trying to parse the JSON response from ASFInfo. It seems like the response is not a valid JSON format :confused:, but rather an HTML page :page_with_curl:.

Here is the stacktrace of the error:

[21:40:18] DEBUG ASF > UrlGetToJsonObject() Request failing: https://www.reddit.com/user/ASFinfo.json?sort=new
[21:40:19] WARN ASF > UrlGetToJsonObject() Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 2, position 4.
> at Newtonsoft.Json.JsonTextReader.ParseValue()
> at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
> 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[T](JsonReader reader)
> at ArchiSteamFarm.Web.WebBrowser.UrlGetToJsonObject[T](Uri request, IReadOnlyCollection`1 headers, Uri referer, ERequestOptions requestOptions, Byte maxTries, Int32 rateLimitingDelay)
> at ArchiSteamFarm.Web.WebBrowser.UrlGetToJsonObject[T](Uri request, IReadOnlyCollection`1 headers, Uri referer, ERequestOptions requestOptions, Byte maxTries, Int32 rateLimitingDelay)
[21:40:19] DEBUG ASF > UrlGetToJsonObject() Request failing: https://www.reddit.com/user/ASFinfo.json?sort=new
[21:40:19] WARN ASF > UrlGetToJsonObject() Request failed after 5 attempts!
[21:40:19]  DEBUG ASF > UrlGetToJsonObject() Request failing: https://www.reddit.com/user/ASFinfo.json?sort=new

Here are some previous comments related to this issue :point_down:

The good news :tada: is that this error seems temporary and doesn't affect the plugin's main functionality in the long term. The bad news :cry: is that it's hard to reproduce it reliably.

It's still unclear :question: if this is a bug on reddit's side or on the plugin's side.

maxisoft commented 1 year ago

selfquote from https://github.com/maxisoft/ASFFreeGames/issues/27#issuecomment-1580753062

I believe those errors occur when reddit servers are showing 5xx internal errors which serve a html page instead of json payload hence the errors 😕.