synzen/MonitoRSS

"Failed to record url fail record": ENOENT

Closed this issue · 1 comments

Describe the bug

When an error occurs fetching a feed, the bot logs an error message trying to record the error.

To Reproduce

  • Running in Docker, latest version:
$ docker run --restart unless-stopped \
  -e 'DRSS_DATABASE_URI=/data' \
  -e 'DRSS_BOT_TOKEN=red.act.ed' \
  -d -v /var/local/Discord.RSS:/data \
  --name discord-rss synzen/monitorss
  • Add a feed entry which would fail to fetch (e.g. 403)
  • Notice an error message in container logs
(Almost) full error log
[2022-02-26 18:43:47.012 +0000] INFO    : [0] MonitoRSS has logged in as "redacted" (ID REDACTED)
[2022-02-26 18:43:47.184 +0000] INFO    : [0] Database URI detected as a folder URI
[2022-02-26 18:43:47.189 +0000] INFO    : [0] Commands have been enabled.
[2022-02-26 18:43:47.191 +0000] INFO    : [M] All shards have initialized by the Sharding Manager.
[2022-02-26 18:43:47.196 +0000] INFO    : [M] Started fetch intervals
[2022-02-26 18:43:49.273 +0000] WARN    : [default] Skipping https://node2.feed43.com/sequential_art_correct_feed.xml
    error: {
      "type": "RequestError",
      "message": "Bad status code (403)",
      "stack":
          Error: Bad status code (403)
              at Function.fetchURL (/app/node_modules/monitorss/src/util/FeedFetcher.js:163:13)
              at processTicksAndRejections (internal/process/task_queues.js:97:5)
              at async Function.fetchURL (/app/node_modules/monitorss/src/util/FeedFetcher.js:148:20)
              at async fetchFeed (/app/node_modules/monitorss/src/util/processor.js:23:32)
              at async getFeed (/app/node_modules/monitorss/src/util/processor.js:101:23)
              at async Promise.all (index 18)
              at async process.<anonymous> (/app/node_modules/monitorss/src/util/processor.js:207:5)
      "cloudflare": false,
      "code": 50042
    }
[2022-02-26 18:43:49.275 +0000] ERROR   : [M] Failed to record url fail record https://node2.feed43.com/sequential_art_correct_feed.xml with reason Bad status code (403)
    Error: ENOENT: no such file or directory, open '/data/fail_records/https:/node2.feed43.com/sequential_art_correct_feed.xml.json'
        at Object.openSync (fs.js:462:3)
        at Object.writeFileSync (fs.js:1384:35)
        at FailRecord.saveToFile (/app/node_modules/monitorss/src/structs/db/Base.js:517:16)
        at FailRecord.save (/app/node_modules/monitorss/src/structs/db/Base.js:427:19)
        at processTicksAndRejections (internal/process/task_queues.js:97:5)
        at async Function.record (/app/node_modules/monitorss/src/structs/db/FailRecord.js:54:7)
        at async ScheduleManager._onConnectionFailure (/app/node_modules/monitorss/src/structs/ScheduleManager.js:70:7)
[2022-02-26 18:43:50.294 +0000] INFO    : [default] Finished feed retrieval cycle (2/35 failed). Cycle Time: 3.10s

Expected behavior

No error log in container and error structurally logged to fail_records directory (in fact it exists but is empty).

Branch

Docker latest.

Hi, this is a known issue because characters like / in the URL makes the OS think it's a nested path - an error that just failure tracking.

Due to my limited capacity at the moment (stabilization/rearchitecture is the priority at the moment for the hosted public bot) however, I will have to forgo fixing this since the intended plan is to eventually stop supporting file-based storage.

The error itself is harmless to the bot's core functions, but I would suggest you try to move it onto a hosted MongoDB if possible since that will be the plan