zadam / trilium

Build your personal knowledge base with Trilium Notes
GNU Affero General Public License v3.0
26.91k stars 1.88k forks source link

Clipper: "Request Failed" on one page only? #1190

Closed LorenAmelang closed 4 years ago

LorenAmelang commented 4 years ago

Version 0.43.3

This one page https://nursefocus.net/7-best-pulse-oximeters-reviews-buyers-guide/ can't be clipped. It pops up "we could not contact Trilium instance", despite "check" working, and any other page I've tried clipping properly. Wireshark shows the entire page uploaded, and then: 774 17:52:49.788193 0.000037 localhost localhost HTTP 10434 0x0e19 (3609) POST /api/clipper/notes HTTP/1.1 (application/json) 777 17:52:49.816493 0.026475 localhost localhost HTTP 506 0x0e1c (3612) HTTP/1.1 500 Internal Server Error (text/plain)

Your log shows:

17:52:40.191 INFO  POST /api/clipper/notes 
17:52:40.195 INFO  Creating clipped note from https://nursefocus.net/7-best-pulse-oximeters-reviews-buyers-guide/ 
17:52:40.217 INFO  Saving image inline.svg 
17:52:40.219 INFO  ERROR: post /api/clipper/notes threw exception: Error: Could not find MIME for Buffer <null>
    at Jimp.parseBitmap (C:\Apps\trilium-windows-x64\resources\app.asar\node_modules\@jimp\core\dist\utils\image-bitmap.js:187:15)
    at Jimp.parseBitmap (C:\Apps\trilium-windows-x64\resources\app.asar\node_modules\@jimp\core\dist\index.js:521:32)
    at new Jimp (C:\Apps\trilium-windows-x64\resources\app.asar\node_modules\@jimp\core\dist\index.js:474:13)
    at _construct (C:\Apps\trilium-windows-x64\resources\app.asar\node_modules\@babel\runtime\helpers\construct.js:19:21)
    at C:\Apps\trilium-windows-x64\resources\app.asar\node_modules\@jimp\core\dist\index.js:1016:32
    at new Promise (<anonymous>)
    at Function.Jimp.read (C:\Apps\trilium-windows-x64\resources\app.asar\node_modules\@jimp\core\dist\index.js:1015:10)
    at resize (C:\Apps\trilium-windows-x64\resources\app.asar\src\services\image.js:125:30)
    at async shrinkImage (C:\Apps\trilium-windows-x64\resources\app.asar\src\services\image.js:101:26)
    at async processImage (C:\Apps\trilium-windows-x64\resources\app.asar\src\services\image.js:26:50) 
17:52:45.212 INFO  Cannot find note content for noteId=ssT7SBKZn4Sz
{}
Error: Cannot find note content for noteId=ssT7SBKZn4Sz
    at Note.getContent (C:\Apps\trilium-windows-x64\resources\app.asar\src\entities\note.js:84:27)
    at async C:\Apps\trilium-windows-x64\resources\app.asar\src\services\notes.js:360:37
    at async Object.transactional (C:\Apps\trilium-windows-x64\resources\app.asar\src\services\sql.js:242:21)
    at async Timeout._onTimeout (C:\Apps\trilium-windows-x64\resources\app.asar\src\services\notes.js:356:13) 
17:52:47.287 INFO  GET /api/clipper/handshake 
17:52:49.788 INFO  POST /api/clipper/notes 
17:52:49.791 INFO  Creating clipped note from https://nursefocus.net/7-best-pulse-oximeters-reviews-buyers-guide/ 
17:52:49.814 INFO  Saving image inline.svg 
17:52:49.815 INFO  ERROR: post /api/clipper/notes threw exception: Error: Could not find MIME for Buffer <null>
    at Jimp.parseBitmap (C:\Apps\trilium-windows-x64\resources\app.asar\node_modules\@jimp\core\dist\utils\image-bitmap.js:187:15)
    at Jimp.parseBitmap (C:\Apps\trilium-windows-x64\resources\app.asar\node_modules\@jimp\core\dist\index.js:521:32)
    at new Jimp (C:\Apps\trilium-windows-x64\resources\app.asar\node_modules\@jimp\core\dist\index.js:474:13)
    at _construct (C:\Apps\trilium-windows-x64\resources\app.asar\node_modules\@babel\runtime\helpers\construct.js:19:21)
    at C:\Apps\trilium-windows-x64\resources\app.asar\node_modules\@jimp\core\dist\index.js:1016:32
    at new Promise (<anonymous>)
    at Function.Jimp.read (C:\Apps\trilium-windows-x64\resources\app.asar\node_modules\@jimp\core\dist\index.js:1015:10)
    at resize (C:\Apps\trilium-windows-x64\resources\app.asar\src\services\image.js:125:30)
    at async shrinkImage (C:\Apps\trilium-windows-x64\resources\app.asar\src\services\image.js:101:26)
    at async processImage (C:\Apps\trilium-windows-x64\resources\app.asar\src\services\image.js:26:50) 
17:52:54.806 INFO  Cannot find note content for noteId=3UWSKN9t1IFP
{}
Error: Cannot find note content for noteId=3UWSKN9t1IFP
    at Note.getContent (C:\Apps\trilium-windows-x64\resources\app.asar\src\entities\note.js:84:27)
    at async C:\Apps\trilium-windows-x64\resources\app.asar\src\services\notes.js:360:37
    at async Object.transactional (C:\Apps\trilium-windows-x64\resources\app.asar\src\services\sql.js:242:21)
    at async Timeout._onTimeout (C:\Apps\trilium-windows-x64\resources\app.asar\src\services\notes.js:356:13) 
17:53:47.293 INFO  GET /api/clipper/handshake 

Is there anything I can do when this happens? My other tools all clip this page normally.

trilium-2020-08-13.log

zadam commented 4 years ago

Hello, I can't reproduce - clipping whole page works as intended.

However given the info you provided it seems like there is some rogue image which is difficult to process. I made changes to make the processing more robust with a fallback handling so the whole clipping does not fail because of one problematic image.