dokkaner / teemii

A versatile, self-hosted manga reader and manager with extensible agent-based metadata retrieval
https://www.teemii.io
MIT License
308 stars 19 forks source link

ERROR: getAllManga failed #64

Open kn-f opened 9 months ago

kn-f commented 9 months ago

Description

When loading Teemii pages, it tells me that I have no manga in the collection when I do have a few. Error log reports: ERROR: getAllManga failed (further details in the logs below)

This happens because the services.library.getMangaReadStatus call returns null when the manga is not found instead of a manga object with null attributes.

I don't know why this (the data misalignment) happened but I believe that the function should fail in a more graceful manner (i.e. setting the manga as unread) as right now it's showing empty collections.

To fix this I've run this query: update manga set readProgress =0;

Version

0.8.2

Steps to Reproduce

I don't know how to cause the inconsistency but the error happens when the services.library.getMangaReadStatus does not find a manga and returns null

What I see are pages as if I just installed Teemii with no mangas associated

Screenshots

No response

Logs

teemii-teemii-backend-1   | [2024-01-19 13:10:00.014 +0000] INFO: Finished syncing updates with scrobblers.
teemii-teemii-backend-1   | [2024-01-19 13:11:00.008 +0000] INFO: Processing maintenance job.
teemii-teemii-backend-1   | [2024-01-19 13:22:00.006 +0000] INFO: Processing maintenance job.
teemii-teemii-backend-1   | [2024-01-19 13:33:00.004 +0000] INFO: Processing maintenance job.
teemii-teemii-backend-1   | [2024-01-19 13:39:59.711 +0000] ERROR: getAllManga failed.
teemii-teemii-backend-1   |     err: {
teemii-teemii-backend-1   |       "type": "TypeError",
teemii-teemii-backend-1   |       "message": "Cannot read properties of null (reading 'lastUpdated')",
teemii-teemii-backend-1   |       "stack":
teemii-teemii-backend-1   |           TypeError: Cannot read properties of null (reading 'lastUpdated')
teemii-teemii-backend-1   |               at getAllManga (/app/src/controllers/libraryController.js:678:46)
teemii-teemii-backend-1   |     }

Platform

desktop

Device

PC & Mobile

Operating System

Windows 11

Browser

Firefox

Additional Context

Hosted in docker on a linux server Please feel free to ask for further clarifications and help if I can support

Code of Conduct

dokkaner commented 9 months ago

Hello, I don't know how you came across this bug, but it's pretty °_°. Thanks a lot for the feedback.

kn-f commented 8 months ago

Hello @dokkaner , not sure how it happened, I'll do some testing in another instance, I feel it's related to workers but it's just an hypothesis. I wish I could submit a patch but my JS skills are close to zero. Thanks for the great work, I've been looking for this app for years!

Edit: and thanks a lot for your great positive attitude!

licebmi commented 7 months ago

This issue strikes again. The way I found to trigger it, is to add a new manga and mark it as read without reading any chapter. This will set readProgress to 100 on manga table, which will trigger the code that searchs for the last activity on stats; but since there are not any activities related to this manga, it will fail hard.