Qolors / FeedCord

A dead simple RSS Feed with Discord Webhooks
MIT License
154 stars 11 forks source link

Docker Container Restarting After Every 60 Seconds & Not Sending To Discord Channel #21

Closed collinsmc23 closed 8 months ago

collinsmc23 commented 8 months ago

Hi!

Pardon my ignorance, I may be missing something obvious here...

I deployed FeedCord on a test EC2 t2.nano instance with the Docker engine and docker-compose installed. I am using a test RSS feed (r/AskReddit).

Unfortunately, the Discord channel is not populating the results.

I've noticed the Docker container restarts ~60 seconds, not sure if this is by-design. I haven't looked into the source code.

Any guidance would be greatly appreciated!

FeedCord Docker Container IMG

Qolors commented 8 months ago

Hey no worries - let's see what could be the cause.

To start the container should not be restarting like that so it's failing on start up. Can you pause the container and provide a print of the container's logs? Should be a good place for us to start - thanks!

collinsmc23 commented 8 months ago

Thank you for the quick response here. Here is a snippet of the docker container logs. This same error message continues to repeat the same error message. The file is too big (33 MB) to upload. From the error message one line 1, it appears it's not loading appsetttings.json.

{"log":"Unhandled exception. System.IO.InvalidDataException: Failed to load configuration from file '/app/config/appsettings.json'.\n","stream":"stderr","time":"2024-03-10T18:59:58.616355779Z"}
{"log":" ---\u003e System.FormatException: Could not parse the JSON file.\n","stream":"stderr","time":"2024-03-10T18:59:58.616461273Z"}
{"log":" ---\u003e System.Text.Json.JsonReaderException: '}' is an invalid start of a value. LineNumber: 17 | BytePositionInLine: 0.\n","stream":"stderr","time":"2024-03-10T18:59:58.616468191Z"}
{"log":"   at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader\u0026 json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)\n","stream":"stderr","time":"2024-03-10T18:59:58.616472857Z"}
{"log":"   at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker)\n","stream":"stderr","time":"2024-03-10T18:59:58.616481431Z"}
{"log":"   at System.Text.Json.Utf8JsonReader.ConsumeNextTokenUntilAfterAllCommentsAreSkipped(Byte marker)\n","stream":"stderr","time":"2024-03-10T18:59:58.616485809Z"}
{"log":"   at System.Text.Json.Utf8JsonReader.ConsumeNextToken(Byte marker)\n","stream":"stderr","time":"2024-03-10T18:59:58.616490342Z"}
{"log":"   at System.Text.Json.Utf8JsonReader.ConsumeNextTokenOrRollback(Byte marker)\n","stream":"stderr","time":"2024-03-10T18:59:58.616494565Z"}
{"log":"   at System.Text.Json.Utf8JsonReader.ReadSingleSegment()\n","stream":"stderr","time":"2024-03-10T18:59:58.616498719Z"}
{"log":"   at System.Text.Json.Utf8JsonReader.Read()\n","stream":"stderr","time":"2024-03-10T18:59:58.616525496Z"}
{"log":"   at System.Text.Json.JsonDocument.Parse(ReadOnlySpan`1 utf8JsonSpan, JsonReaderOptions readerOptions, MetadataDb\u0026 database, StackRowStack\u0026 stack)\n","stream":"stderr","time":"2024-03-10T18:59:58.61653127Z"}
{"log":"   at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 utf8Json, JsonReaderOptions readerOptions, Byte[] extraRentedArrayPoolBytes, PooledByteBufferWriter extraPooledByteBufferWriter)\n","stream":"stderr","time":"2024-03-10T18:59:58.61653592Z"}
{"log":"   at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 json, JsonDocumentOptions options)\n","stream":"stderr","time":"2024-03-10T18:59:58.616540535Z"}
{"log":"   at System.Text.Json.JsonDocument.Parse(String json, JsonDocumentOptions options)\n","stream":"stderr","time":"2024-03-10T18:59:58.616544818Z"}
{"log":"   at Microsoft.Extensions.Configuration.Json.JsonConfigurationFileParser.ParseStream(Stream input)\n","stream":"stderr","time":"2024-03-10T18:59:58.616549112Z"}
{"log":"   at Microsoft.Extensions.Configuration.Json.JsonConfigurationFileParser.Parse(Stream input)\n","stream":"stderr","time":"2024-03-10T18:59:58.616553318Z"}
{"log":"   at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load(Stream stream)\n","stream":"stderr","time":"2024-03-10T18:59:58.616557532Z"}
{"log":"   --- End of inner exception stack trace ---\n","stream":"stderr","time":"2024-03-10T18:59:58.616562063Z"}
{"log":"   at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load(Stream stream)\n","stream":"stderr","time":"2024-03-10T18:59:58.616566234Z"}
{"log":"   at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)\n","stream":"stderr","time":"2024-03-10T18:59:58.616570371Z"}
{"log":"   --- End of inner exception stack trace ---\n","stream":"stderr","time":"2024-03-10T18:59:58.616574555Z"}
{"log":"   at Microsoft.Extensions.Configuration.FileConfigurationProvider.HandleException(ExceptionDispatchInfo info)\n","stream":"stderr","time":"2024-03-10T18:59:58.616578831Z"}
{"log":"   at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)\n","stream":"stderr","time":"2024-03-10T18:59:58.616584379Z"}
{"log":"   at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()\n","stream":"stderr","time":"2024-03-10T18:59:58.616588626Z"}
{"log":"   at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)\n","stream":"stderr","time":"2024-03-10T18:59:58.616592802Z"}
{"log":"   at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()\n","stream":"stderr","time":"2024-03-10T18:59:58.616597191Z"}
{"log":"   at Microsoft.Extensions.Hosting.HostBuilder.InitializeAppConfiguration()\n","stream":"stderr","time":"2024-03-10T18:59:58.616608776Z"}
{"log":"   at Microsoft.Extensions.Hosting.HostBuilder.Build()\n","stream":"stderr","time":"2024-03-10T18:59:58.616613326Z"}
{"log":"   at FeedCord.src.Startup.Initialize(String[] args) in /src/src/Startup.cs:line 21\n","stream":"stderr","time":"2024-03-10T18:59:58.616617534Z"}
{"log":"   at FeedCord.src.Program.Main(String[] args) in /src/src/Program.cs:line 7\n","stream":"stderr","time":"2024-03-10T18:59:58.616697377Z"}
{"log":"Unhandled exception. System.IO.InvalidDataException: Failed to load configuration from file '/app/config/appsettings.json'.\n","stream":"stderr","time":"2024-03-10T18:59:59.741474799Z"}
{"log":" ---\u003e System.FormatException: Could not parse the JSON file.\n","stream":"stderr","time":"2024-03-10T18:59:59.741831833Z"}
{"log":" ---\u003e System.Text.Json.JsonReaderException: '}' is an invalid start of a value. LineNumber: 17 | BytePositionInLine: 0.\n","stream":"stderr","time":"2024-03-10T18:59:59.741841798Z"}
{"log":"   at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader\u0026 json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)\n","stream":"stderr","time":"2024-03-10T18:59:59.741861147Z"}
{"log":"   at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker)\n","stream":"stderr","time":"2024-03-10T18:59:59.741866616Z"}
{"log":"   at System.Text.Json.Utf8JsonReader.ConsumeNextTokenUntilAfterAllCommentsAreSkipped(Byte marker)\n","stream":"stderr","time":"2024-03-10T18:59:59.741871015Z"}
{"log":"   at System.Text.Json.Utf8JsonReader.ConsumeNextToken(Byte marker)\n","stream":"stderr","time":"2024-03-10T18:59:59.741875572Z"}
{"log":"   at System.Text.Json.Utf8JsonReader.ConsumeNextTokenOrRollback(Byte marker)\n","stream":"stderr","time":"2024-03-10T18:59:59.741879868Z"}
{"log":"   at System.Text.Json.Utf8JsonReader.ReadSingleSegment()\n","stream":"stderr","time":"2024-03-10T18:59:59.741884177Z"}
{"log":"   at System.Text.Json.Utf8JsonReader.Read()\n","stream":"stderr","time":"2024-03-10T18:59:59.741888268Z"}
{"log":"   at System.Text.Json.JsonDocument.Parse(ReadOnlySpan`1 utf8JsonSpan, JsonReaderOptions readerOptions, MetadataDb\u0026 database, StackRowStack\u0026 stack)\n","stream":"stderr","time":"2024-03-10T18:59:59.741892492Z"}
{"log":"   at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 utf8Json, JsonReaderOptions readerOptions, Byte[] extraRentedArrayPoolBytes, PooledByteBufferWriter extraPooledByteBufferWriter)\n","stream":"stderr","time":"2024-03-10T18:59:59.741896936Z"}
{"log":"   at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 json, JsonDocumentOptions options)\n","stream":"stderr","time":"2024-03-10T18:59:59.741901334Z"}
{"log":"   at System.Text.Json.JsonDocument.Parse(String json, JsonDocumentOptions options)\n","stream":"stderr","time":"2024-03-10T18:59:59.741907296Z"}
{"log":"   at Microsoft.Extensions.Configuration.Json.JsonConfigurationFileParser.ParseStream(Stream input)\n","stream":"stderr","time":"2024-03-10T18:59:59.74191156Z"}
{"log":"   at Microsoft.Extensions.Configuration.Json.JsonConfigurationFileParser.Parse(Stream input)\n","stream":"stderr","time":"2024-03-10T18:59:59.741915819Z"}
{"log":"   at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load(Stream stream)\n","stream":"stderr","time":"2024-03-10T18:59:59.741919948Z"}
{"log":"   --- End of inner exception stack trace ---\n","stream":"stderr","time":"2024-03-10T18:59:59.741946844Z"}
{"log":"   at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load(Stream stream)\n","stream":"stderr","time":"2024-03-10T18:59:59.741951189Z"}
{"log":"   at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)\n","stream":"stderr","time":"2024-03-10T18:59:59.741955549Z"}
{"log":"   --- End of inner exception stack trace ---\n","stream":"stderr","time":"2024-03-10T18:59:59.741959853Z"}
{"log":"   at Microsoft.Extensions.Configuration.FileConfigurationProvider.HandleException(ExceptionDispatchInfo info)\n","stream":"stderr","time":"2024-03-10T18:59:59.741971949Z"}
{"log":"   at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)\n","stream":"stderr","time":"2024-03-10T18:59:59.741978184Z"}
{"log":"   at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()\n","stream":"stderr","time":"2024-03-10T18:59:59.741982528Z"}
{"log":"   at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)\n","stream":"stderr","time":"2024-03-10T18:59:59.741986889Z"}
{"log":"   at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()\n","stream":"stderr","time":"2024-03-10T18:59:59.741991135Z"}
{"log":"   at Microsoft.Extensions.Hosting.HostBuilder.InitializeAppConfiguration()\n","stream":"stderr","time":"2024-03-10T18:59:59.741995367Z"}
{"log":"   at Microsoft.Extensions.Hosting.HostBuilder.Build()\n","stream":"stderr","time":"2024-03-10T18:59:59.741999668Z"}
{"log":"   at FeedCord.src.Startup.Initialize(String[] args) in /src/src/Startup.cs:line 21\n","stream":"stderr","time":"2024-03-10T18:59:59.742004015Z"}
{"log":"   at FeedCord.src.Program.Main(String[] args) in /src/src/Program.cs:line 7\n","stream":"stderr","time":"2024-03-10T18:59:59.742008284Z"}
{"log":"Unhandled exception. System.IO.InvalidDataException: Failed to load configuration from file '/app/config/appsettings.json'.\n","stream":"stderr","time":"2024-03-10T19:00:00.852205779Z"}
{"log":" ---\u003e System.FormatException: Could not parse the JSON file.\n","stream":"stderr","time":"2024-03-10T19:00:00.852249348Z"}
{"log":" ---\u003e System.Text.Json.JsonReaderException: '}' is an invalid start of a value. LineNumber: 17 | BytePositionInLine: 0.\n","stream":"stderr","time":"2024-03-10T19:00:00.852255452Z"}
{"log":"   at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader\u0026 json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)\n","stream":"stderr","time":"2024-03-10T19:00:00.852260489Z"}
{"log":"   at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker)\n","stream":"stderr","time":"2024-03-10T19:00:00.85226526Z"}
{"log":"   at System.Text.Json.Utf8JsonReader.ConsumeNextTokenUntilAfterAllCommentsAreSkipped(Byte marker)\n","stream":"stderr","time":"2024-03-10T19:00:00.852287575Z"}
{"log":"   at System.Text.Json.Utf8JsonReader.ConsumeNextToken(Byte marker)\n","stream":"stderr","time":"2024-03-10T19:00:00.852292286Z"}
{"log":"   at System.Text.Json.Utf8JsonReader.ConsumeNextTokenOrRollback(Byte marker)\n","stream":"stderr","time":"2024-03-10T19:00:00.85229682Z"}
{"log":"   at System.Text.Json.Utf8JsonReader.ReadSingleSegment()\n","stream":"stderr","time":"2024-03-10T19:00:00.852301622Z"}
{"log":"   at System.Text.Json.Utf8JsonReader.Read()\n","stream":"stderr","time":"2024-03-10T19:00:00.852306129Z"}
{"log":"   at System.Text.Json.JsonDocument.Parse(ReadOnlySpan`1 utf8JsonSpan, JsonReaderOptions readerOptions, MetadataDb\u0026 database, StackRowStack\u0026 stack)\n","stream":"stderr","time":"2024-03-10T19:00:00.852310477Z"}
{"log":"   at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 utf8Json, JsonReaderOptions readerOptions, Byte[] extraRentedArrayPoolBytes, PooledByteBufferWriter extraPooledByteBufferWriter)\n","stream":"stderr","time":"2024-03-10T19:00:00.85231562Z"}
{"log":"   at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 json, JsonDocumentOptions options)\n","stream":"stderr","time":"2024-03-10T19:00:00.852320281Z"}
{"log":"   at System.Text.Json.JsonDocument.Parse(String json, JsonDocumentOptions options)\n","stream":"stderr","time":"2024-03-10T19:00:00.85232469Z"}
{"log":"   at Microsoft.Extensions.Configuration.Json.JsonConfigurationFileParser.ParseStream(Stream input)\n","stream":"stderr","time":"2024-03-10T19:00:00.852329029Z"}
{"log":"   at Microsoft.Extensions.Configuration.Json.JsonConfigurationFileParser.Parse(Stream input)\n","stream":"stderr","time":"2024-03-10T19:00:00.852333469Z"}
{"log":"   at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load(Stream stream)\n","stream":"stderr","time":"2024-03-10T19:00:00.852337837Z"}
{"log":"   --- End of inner exception stack trace ---\n","stream":"stderr","time":"2024-03-10T19:00:00.852353115Z"}
{"log":"   at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load(Stream stream)\n","stream":"stderr","time":"2024-03-10T19:00:00.852357645Z"}
{"log":"   at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)\n","stream":"stderr","time":"2024-03-10T19:00:00.852362026Z"}
{"log":"   --- End of inner exception stack trace ---\n","stream":"stderr","time":"2024-03-10T19:00:00.85236632Z"}
{"log":"   at Microsoft.Extensions.Configuration.FileConfigurationProvider.HandleException(ExceptionDispatchInfo info)\n","stream":"stderr","time":"2024-03-10T19:00:00.852370578Z"}
{"log":"   at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)\n","stream":"stderr","time":"2024-03-10T19:00:00.852375922Z"}
{"log":"   at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()\n","stream":"stderr","time":"2024-03-10T19:00:00.852380527Z"}
{"log":"   at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)\n","stream":"stderr","time":"2024-03-10T19:00:00.852384819Z"}
{"log":"   at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()\n","stream":"stderr","time":"2024-03-10T19:00:00.852389086Z"}
{"log":"   at Microsoft.Extensions.Hosting.HostBuilder.InitializeAppConfiguration()\n","stream":"stderr","time":"2024-03-10T19:00:00.852393321Z"}
{"log":"   at Microsoft.Extensions.Hosting.HostBuilder.Build()\n","stream":"stderr","time":"2024-03-10T19:00:00.852397658Z"}
{"log":"   at FeedCord.src.Startup.Initialize(String[] args) in /src/src/Startup.cs:line 21\n","stream":"stderr","time":"2024-03-10T19:00:00.85240189Z"}
{"log":"   at FeedCord.src.Program.Main(String[] args) in /src/src/Program.cs:line 7\n","stream":"stderr","time":"2024-03-10T19:00:00.852473322Z"}

Thanks!

Qolors commented 8 months ago
{"log":" ---\u003e System.Text.Json.JsonReaderException: '}' is an invalid start of a value. LineNumber: 17 | BytePositionInLine: 0.\n","stream":"stderr","time":"2024-03-10T18:59:58.616468191Z"}

Minus all of the properties, if you take a look at your appsettings file according to the error log mentioning line 17 you have it like so:

Instances: [ 
   {

   }, <----
]

You see that comma at the end of your first instance? Removing that should solve your issue. I failed to catch too at first glance.. Let me know if that indeed is the case!

collinsmc23 commented 8 months ago

Hi!

Thanks for the reply. It didn't catch the mistake. I have corrected the format settings in appsettings.json. It still appears the FeedCord is not working.

Here's a screenshot of my new configuration file.

FeedCord Docker Container IMG

Here is a snipped of the output error output in `/var/lib/docker/containers/

{"log":"Number of configurations loaded: 1\n","stream":"stdout","time":"2024-03-16T00:16:42.925426894Z"}
{"log":"Registering Background Service Security News Channel\n","stream":"stdout","time":"2024-03-16T00:16:43.015533469Z"}
{"log":"I: Creating new RssCheckerBackgroundService instance for Security News Channel\n","stream":"stdout","time":"2024-03-16T00:16:43.118934397Z"}
{"log":"I: Security News Channel Created with check interval 1 minutes\n","stream":"stdout","time":"2024-03-16T00:16:43.119916821Z"}
{"log":"I: Security News Channel Starting Background Processing at 03/16/2024 00:16:43..\n","stream":"stdout","time":"2024-03-16T00:16:43.150461576Z"}
{"log":"I: Security News Channel: Initializing Url Checks..\n","stream":"stdout","time":"2024-03-16T00:16:43.151902196Z"}
{"log":"I: Successfully initialized URL: https://www.reddit.com/r/AskReddit/new/.rss\n","stream":"stdout","time":"2024-03-16T00:16:43.818990484Z"}
{"log":"I: No URLs in Youtube feed, skipping...\n","stream":"stdout","time":"2024-03-16T00:16:43.819666126Z"}
{"log":"I: Security News Channel: Tested successfully for 1 out of 1 Urls in Configuration File\n","stream":"stdout","time":"2024-03-16T00:16:43.819984411Z"}
{"log":"I: Checking if any new posts for https://www.reddit.com/r/AskReddit/new/.rss...\n","stream":"stdout","time":"2024-03-16T00:16:43.82821633Z"}
{"log":"I: Security News Channel: Found no new posts. Ending background process..\n","stream":"stdout","time":"2024-03-16T00:16:44.197931019Z"}
{"log":"I: Security News Channel Finished Background Processing at 03/16/2024 00:16:44..\n","stream":"stdout","time":"2024-03-16T00:16:44.198700399Z"}
{"log":"I: Security News Channel Starting Background Processing at 03/16/2024 00:17:44..\n","stream":"stdout","time":"2024-03-16T00:17:44.200208834Z"}
{"log":"I: Checking if any new posts for https://www.reddit.com/r/AskReddit/new/.rss...\n","stream":"stdout","time":"2024-03-16T00:17:44.20024595Z"}
{"log":"I: Found new post for Url: https://www.reddit.com/r/AskReddit/new/.rss\n","stream":"stdout","time":"2024-03-16T00:17:44.394243934Z"}
{"log":"I: Found new post for Url: https://www.reddit.com/r/AskReddit/new/.rss\n","stream":"stdout","time":"2024-03-16T00:17:44.394425866Z"}
{"log":"I: Found new post for Url: https://www.reddit.com/r/AskReddit/new/.rss\n","stream":"stdout","time":"2024-03-16T00:17:44.394569111Z"}
{"log":"I: Security News Channel: Found 3 new posts..\n","stream":"stdout","time":"2024-03-16T00:17:44.397068319Z"}
{"log":"E: Received Status Code - BadRequest: Failed post to Discord Channel\n","stream":"stdout","time":"2024-03-16T00:17:44.694763325Z"}
{"log":"E: Received Status Code - BadRequest: Failed post to Discord Channel\n","stream":"stdout","time":"2024-03-16T00:17:54.782882859Z"}

The Discord channel I am sending to is set for only administrators to view. Would that impact this process?

Thanks!

Qolors commented 8 months ago

hey @collinsmc23 - so this is good news as FeedCord is now running properly! For Bad Request lets look at two things here..

Let me know if these issues resolve it - thanks

collinsmc23 commented 8 months ago

I created a new test forum channel and a new web hook. It works!

Does FeedCord work with regular text channels?

Qolors commented 8 months ago
  • With our Forum property set to True, make sure the channel the webhook is from is actually a Forum Channel.. Not a normal text channel. If it is a normal text channel then set Forum to false

@collinsmc23 Yes - just set Forum property to "false" for normal Text Channels. Glad we were able to get it going - closing the issue but feel free if there's any other issues requests. Thanks!