C9Glax / tranga

Docker-Container to monitor (Manga) Scanlation-Sites for download new chapters.
GNU General Public License v3.0
108 stars 10 forks source link

[It broke]: value in notificationConnectors.json is null for ntfy notifications #174

Closed nickconway closed 2 months ago

nickconway commented 2 months ago

What is broken?

After restarting the docker container, the api fails to start because of a null value in notificationConnectors.json.

Log-output

tranga-api  | No parameter provided for argument -l. -h for help.
tranga-api  | [04/24/2024 20:04:20.281]        Logger | Logfile: /usr/share/tranga-api/logs/04/24/2024_20-4-20.log
tranga-api  | Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'value')
tranga-api  |    at Newtonsoft.Json.Utilities.ValidationUtils.ArgumentNotNull(Object value, String parameterName)
tranga-api  |    at Newtonsoft.Json.Linq.Extensions.Value[T,U](IEnumerable`1 value)
tranga-api  |    at Newtonsoft.Json.Linq.Extensions.Value[U](IEnumerable`1 value)
tranga-api  |    at Tranga.NotificationConnectors.NotificationManagerJsonConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) in /src/Tranga/NotificationConnectors/NotificationManagerJsonConverter.cs:line 31
tranga-api  |    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
tranga-api  |    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
tranga-api  |    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
tranga-api  |    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
tranga-api  |    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
tranga-api  |    at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
tranga-api  |    at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
tranga-api  |    at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
tranga-api  |    at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
tranga-api  |    at Tranga.TrangaSettings.LoadNotificationConnectors(GlobalBase clone) in /src/Tranga/TrangaSettings.cs:line 97
tranga-api  |    at Tranga.GlobalBase..ctor(Logger logger, TrangaSettings settings) in /src/Tranga/GlobalBase.cs:line 34
tranga-api  |    at Tranga.Tranga..ctor(Logger logger, TrangaSettings settings) in /src/Tranga/Tranga.cs:line 14
tranga-api  |    at Tranga.Tranga.Main(String[] args) in /src/Tranga/TrangaArgs.cs:line 53

Additional stuff

I think the value throwing the error is auth based on this line in NotificationManagerJsonConverter.cs return new Ntfy(this._clone, jo.GetValue("endpoint")!.Value<string>()!, jo.GetValue("auth")!.Value<string>()!);

auth doesn't seem to ever get written to the file.

My notificationConnectors.json: [{"notificationConnectorType":2,"endpoint":"https://ntfy.conway.dev"}]

C9Glax commented 2 months ago

Delete the notification connector file or set auth manually as a string. Fixed it for the future