marius-wieschollek / passwords

A simple, yet feature rich password manager for Nextcloud
GNU Affero General Public License v3.0
206 stars 42 forks source link

[BUG]: Fatal passwords ImaginaryCommunicationException Imaginary request failed #663

Open yward opened 1 month ago

yward commented 1 month ago

⚠️ This issue respects the following points: ⚠️

Server Information

Running Nextcloud AIO
Operating System: Linux 6.8.0-38-generic x86_64
CPU: Intel Xeon Processor (Skylake, IBRS, no TSX) (4 cores)
Memory: 7.57 GB
PHP Version: 8.2.21
PHP Memory limit: 3 GB
PHP Max execution time: 3600
PHP Upload max size: 10 GB
OPcache Revalidate Frequency: 60
Database Type: pgsql
Database Version: PostgreSQL 16.3 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20240309) 13.2.1 20240309, 64-bit

Client Information

Browser and Version: Microsoft Edge - Version 126.0.2592.113 (Official build) (64-bit) Client OS and Version: Windows 11 22H2

Bug description

Favicons and previews do not work regardless of the service you choose in settings and the app throws errors in nextcloud logs. Passwords app generates the following error each visit:

Error | passwords | Error "Internal Website Preview API Error" in OCA\Passwords\Controller\Api\ServiceApiController::getPreview Fatal | passwords | ImaginaryCommunicationExceptionImaginary request failed Fatal | passwords | ApiExceptionInternal Website Preview API Error

Steps to reproduce

-Install Nextcloud AIO (Latest) with Imaginary enabled. -Install Passwords App -Visit Passwords App

Expected behavior

App runs without errors and preview/favicons work. Favicons and previews do not work regardless of the service you choose in settings and the app throws errors in nextcloud logs.

Nextcloud Logs

Error | passwords | Error "Internal Website Preview API Error" in OCA\Passwords\Controller\Api\ServiceApiController::getPreview
Fatal | passwords | ImaginaryCommunicationExceptionImaginary request failed
Fatal | passwords | ApiExceptionInternal Website Preview API Error

Browser Logs

No errors in Console, just the normal passwords app "STOP" message.
yward commented 1 month ago

Issue is solved by changing image rendering settings to Imagick/Gmagick instead of the default "Automatically Select".

marius-wieschollek commented 1 month ago

With just the message but not the acutal stack trace of the exception, i have nothing to debug here.

yward commented 1 month ago

With just the message but not the acutal stack trace of the exception, i have nothing to debug here.

There is no stack trace in the error logs, just the individual messages. If there is a way for me to obtain the stack trace, please let me know and I'll happily get them for you. The manual debugging I did points that if we select Imaginary or "Automatically Select" as the image renderer, the errors appear in each app load.

marius-wieschollek commented 1 month ago

Here is how to get the error details: https://git.mdns.eu/nextcloud/passwords/-/wikis/Administrators/Guides/Maintenance/App-Debugging

The "Automatically Select" option will use Imaginary if the service is configured. If there is any issue with the configuration or the service, it will subsequently crash when trying to use it.

yward commented 1 month ago

Thank you for the pointers, here are the raw entries: {"reqId":"sqqnZp48CtaD94RKFVPf","level":4,"time":"2024-07-29T06:49:11+00:00","remoteAddr":"188.70.41.210","user":"yward","app":"passwords","method":"GET","url":"/index.php/apps/passwords/api/1.0/service/preview/olddomain%3A8083/desktop/640/360...","message":"Imaginary request failed","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 Edg/127.0.0.0","version":"29.0.4.1","exception":{"Exception":"OCA\\Passwords\\Exception\\Image\\Imaginary\\ImaginaryCommunicationException","Message":"Imaginary request failed","Code":0,"Trace":[{"file":"/var/www/html/custom_apps/passwords/lib/Helper/Image/ImaginaryHelper.php","line":43,"function":"sendRequest","class":"OCA\\Passwords\\Helper\\Image\\ImaginaryHelper","type":"->","args":[["OCA\\Passwords\\Helper\\Image\\Imaginary\\ImaginaryImage"],"info"]},{"file":"/var/www/html/custom_apps/passwords/lib/Helper/Preview/ResizePreviewHelper.php","line":77,"function":"advancedResizeImage","class":"OCA\\Passwords\\Helper\\Image\\ImaginaryHelper","type":"->","args":[["OCA\\Passwords\\Helper\\Image\\Imaginary\\ImaginaryImage"],640,360,640,0]},{"file":"/var/www/html/custom_apps/passwords/lib/Services/WebsitePreviewService.php","line":100,"function":"resizePreview","class":"OCA\\Passwords\\Helper\\Preview\\ResizePreviewHelper","type":"->","args":[["OC\\Files\\SimpleFS\\NewSimpleFile"],640,360,640,0]},{"file":"/var/www/html/custom_apps/passwords/lib/Services/WebsitePreviewService.php","line":74,"function":"getWebsitePreview","class":"OCA\\Passwords\\Services\\WebsitePreviewService","type":"->","args":["olddomain:8083","desktop",640,360,640,0]},{"file":"/var/www/html/custom_apps/passwords/lib/Controller/Api/ServiceApiController.php","line":164,"function":"getPreview","class":"OCA\\Passwords\\Services\\WebsitePreviewService","type":"->","args":["olddomain:8083","desktop",640,360,640,0]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":232,"function":"getPreview","class":"OCA\\Passwords\\Controller\\Api\\ServiceApiController","type":"->","args":["olddomain:8083","desktop","640","360..."]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":138,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Passwords\\Controller\\Api\\ServiceApiController"],"getPreview"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Passwords\\Controller\\Api\\ServiceApiController"],"getPreview"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":338,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["ServiceApiController","getPreview",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["olddomain:8083","desktop","640","360...","passwords.service_api.get_preview"]]},{"file":"/var/www/html/lib/base.php","line":1050,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/passwords/api/1.0/service/preview/olddomain%3A8083/desktop/640/360..."]},{"file":"/var/www/html/index.php","line":49,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/custom_apps/passwords/lib/Helper/Image/ImaginaryHelper.php","Line":218,"Previous":{"Exception":"GuzzleHttp\\Exception\\ClientException","Message":"Client error:POST http://nextcloud-aio-imaginary:9000/inforesulted in a401 Unauthorizedresponse:\n{\"message\":\"Invalid or missing API key\",\"status\":401}\n","Code":401,"Trace":[{"file":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Middleware.php","line":72,"function":"create","class":"GuzzleHttp\\Exception\\RequestException","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":204,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":153,"function":"callHandler","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":[1,"*** sensitive parameters replaced ***","*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/TaskQueue.php","line":48,"function":"GuzzleHttp\\Promise\\{closure}","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":248,"function":"run","class":"GuzzleHttp\\Promise\\TaskQueue","type":"->","args":[true]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":224,"function":"invokeWaitFn","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":269,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":226,"function":"invokeWaitList","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":62,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Client.php","line":189,"function":"wait","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/lib/private/Http/Client/Client.php","line":301,"function":"request","class":"GuzzleHttp\\Client","type":"->","args":["post","http://nextcloud-aio-imaginary:9000/info",["/var/www/html/resources/config/ca-bundle.crt",30,"*** sensitive parameters replaced ***",true,null,"And 4 more entries, set log level to debug to see all entries"]]},{"file":"/var/www/html/custom_apps/passwords/lib/Helper/Image/ImaginaryHelper.php","line":208,"function":"post","class":"OC\\Http\\Client\\Client","type":"->","args":["http://nextcloud-aio-imaginary:9000/info",["*** sensitive parameters replaced ***",true,null,[true],30,"And 1 more entries, set log level to debug to see all entries"]]},{"file":"/var/www/html/custom_apps/passwords/lib/Helper/Image/ImaginaryHelper.php","line":43,"function":"sendRequest","class":"OCA\\Passwords\\Helper\\Image\\ImaginaryHelper","type":"->","args":[["OCA\\Passwords\\Helper\\Image\\Imaginary\\ImaginaryImage"],"info"]},{"file":"/var/www/html/custom_apps/passwords/lib/Helper/Preview/ResizePreviewHelper.php","line":77,"function":"advancedResizeImage","class":"OCA\\Passwords\\Helper\\Image\\ImaginaryHelper","type":"->","args":[["OCA\\Passwords\\Helper\\Image\\Imaginary\\ImaginaryImage"],640,360,640,0]},{"file":"/var/www/html/custom_apps/passwords/lib/Services/WebsitePreviewService.php","line":100,"function":"resizePreview","class":"OCA\\Passwords\\Helper\\Preview\\ResizePreviewHelper","type":"->","args":[["OC\\Files\\SimpleFS\\NewSimpleFile"],640,360,640,0]},{"file":"/var/www/html/custom_apps/passwords/lib/Services/WebsitePreviewService.php","line":74,"function":"getWebsitePreview","class":"OCA\\Passwords\\Services\\WebsitePreviewService","type":"->","args":["olddomain:8083","desktop",640,360,640,0]},{"file":"/var/www/html/custom_apps/passwords/lib/Controller/Api/ServiceApiController.php","line":164,"function":"getPreview","class":"OCA\\Passwords\\Services\\WebsitePreviewService","type":"->","args":["olddomain:8083","desktop",640,360,640,0]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":232,"function":"getPreview","class":"OCA\\Passwords\\Controller\\Api\\ServiceApiController","type":"->","args":["olddomain:8083","desktop","640","360..."]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":138,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Passwords\\Controller\\Api\\ServiceApiController"],"getPreview"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Passwords\\Controller\\Api\\ServiceApiController"],"getPreview"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":338,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["ServiceApiController","getPreview",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["olddomain:8083","desktop","640","360...","passwords.service_api.get_preview"]]},{"file":"/var/www/html/lib/base.php","line":1050,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/passwords/api/1.0/service/preview/olddomain%3A8083/desktop/640/360..."]},{"file":"/var/www/html/index.php","line":49,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Exception/RequestException.php","Line":113},"message":"Imaginary request failed","exception":[],"CustomMessage":"Imaginary request failed"},"id":"66a73b7b442e3"} and {"reqId":"z0vILrRbIXvdAGa6gSmN","level":4,"time":"2024-07-29T06:49:04+00:00","remoteAddr":"188.70.41.210","user":"yward","app":"passwords","method":"GET","url":"/index.php/apps/passwords/api/1.0/service/favicon/olddomain%3A8083/96","message":"Imaginary request failed","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 Edg/127.0.0.0","version":"29.0.4.1","exception":{"Exception":"OCA\\Passwords\\Exception\\Image\\Imaginary\\ImaginaryCommunicationException","Message":"Imaginary request failed","Code":0,"Trace":[{"file":"/var/www/html/custom_apps/passwords/lib/Helper/Image/ImaginaryHelper.php","line":86,"function":"sendRequest","class":"OCA\\Passwords\\Helper\\Image\\ImaginaryHelper","type":"->","args":[["OCA\\Passwords\\Helper\\Image\\Imaginary\\ImaginaryImage"],"info"]},{"file":"/var/www/html/custom_apps/passwords/lib/Helper/Favicon/ResizeFaviconHelper.php","line":62,"function":"cropImageRectangular","class":"OCA\\Passwords\\Helper\\Image\\ImaginaryHelper","type":"->","args":[["OCA\\Passwords\\Helper\\Image\\Imaginary\\ImaginaryImage"]]},{"file":"/var/www/html/custom_apps/passwords/lib/Services/FaviconService.php","line":65,"function":"resizeFavicon","class":"OCA\\Passwords\\Helper\\Favicon\\ResizeFaviconHelper","type":"->","args":[["OC\\Files\\SimpleFS\\NewSimpleFile"],96]},{"file":"/var/www/html/custom_apps/passwords/lib/Controller/Api/ServiceApiController.php","line":144,"function":"getFavicon","class":"OCA\\Passwords\\Services\\FaviconService","type":"->","args":["olddomain:8083",96]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":232,"function":"getFavicon","class":"OCA\\Passwords\\Controller\\Api\\ServiceApiController","type":"->","args":["olddomain:8083",96]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":138,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Passwords\\Controller\\Api\\ServiceApiController"],"getFavicon"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Passwords\\Controller\\Api\\ServiceApiController"],"getFavicon"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":338,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["ServiceApiController","getFavicon",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["olddomain:8083","96","passwords.service_api.get_favicon"]]},{"file":"/var/www/html/lib/base.php","line":1050,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/passwords/api/1.0/service/favicon/olddomain%3A8083/96"]},{"file":"/var/www/html/index.php","line":49,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/custom_apps/passwords/lib/Helper/Image/ImaginaryHelper.php","Line":218,"Previous":{"Exception":"GuzzleHttp\\Exception\\ClientException","Message":"Client error:POST http://nextcloud-aio-imaginary:9000/inforesulted in a401 Unauthorizedresponse:\n{\"message\":\"Invalid or missing API key\",\"status\":401}\n","Code":401,"Trace":[{"file":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Middleware.php","line":72,"function":"create","class":"GuzzleHttp\\Exception\\RequestException","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":204,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":153,"function":"callHandler","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":[1,"*** sensitive parameters replaced ***","*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/TaskQueue.php","line":48,"function":"GuzzleHttp\\Promise\\{closure}","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":248,"function":"run","class":"GuzzleHttp\\Promise\\TaskQueue","type":"->","args":[true]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":224,"function":"invokeWaitFn","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":269,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":226,"function":"invokeWaitList","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":62,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Client.php","line":189,"function":"wait","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/lib/private/Http/Client/Client.php","line":301,"function":"request","class":"GuzzleHttp\\Client","type":"->","args":["post","http://nextcloud-aio-imaginary:9000/info",["/var/www/html/resources/config/ca-bundle.crt",30,"*** sensitive parameters replaced ***",true,null,"And 4 more entries, set log level to debug to see all entries"]]},{"file":"/var/www/html/custom_apps/passwords/lib/Helper/Image/ImaginaryHelper.php","line":208,"function":"post","class":"OC\\Http\\Client\\Client","type":"->","args":["http://nextcloud-aio-imaginary:9000/info",["*** sensitive parameters replaced ***",true,null,[true],30,"And 1 more entries, set log level to debug to see all entries"]]},{"file":"/var/www/html/custom_apps/passwords/lib/Helper/Image/ImaginaryHelper.php","line":86,"function":"sendRequest","class":"OCA\\Passwords\\Helper\\Image\\ImaginaryHelper","type":"->","args":[["OCA\\Passwords\\Helper\\Image\\Imaginary\\ImaginaryImage"],"info"]},{"file":"/var/www/html/custom_apps/passwords/lib/Helper/Favicon/ResizeFaviconHelper.php","line":62,"function":"cropImageRectangular","class":"OCA\\Passwords\\Helper\\Image\\ImaginaryHelper","type":"->","args":[["OCA\\Passwords\\Helper\\Image\\Imaginary\\ImaginaryImage"]]},{"file":"/var/www/html/custom_apps/passwords/lib/Services/FaviconService.php","line":65,"function":"resizeFavicon","class":"OCA\\Passwords\\Helper\\Favicon\\ResizeFaviconHelper","type":"->","args":[["OC\\Files\\SimpleFS\\NewSimpleFile"],96]},{"file":"/var/www/html/custom_apps/passwords/lib/Controller/Api/ServiceApiController.php","line":144,"function":"getFavicon","class":"OCA\\Passwords\\Services\\FaviconService","type":"->","args":["olddomain:8083",96]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":232,"function":"getFavicon","class":"OCA\\Passwords\\Controller\\Api\\ServiceApiController","type":"->","args":["olddomain:8083",96]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":138,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Passwords\\Controller\\Api\\ServiceApiController"],"getFavicon"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Passwords\\Controller\\Api\\ServiceApiController"],"getFavicon"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":338,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["ServiceApiController","getFavicon",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["olddomain:8083","96","passwords.service_api.get_favicon"]]},{"file":"/var/www/html/lib/base.php","line":1050,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/passwords/api/1.0/service/favicon/olddomain%3A8083/96"]},{"file":"/var/www/html/index.php","line":49,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Exception/RequestException.php","Line":113},"message":"Imaginary request failed","exception":[],"CustomMessage":"Imaginary request failed"},"id":"66a73b85bb6c8"}

yward commented 1 month ago

I noticed that an old domain name from a server I exported passwords from is showing in the logs, i replaced the domain name with "olddomain", perhaps this will help.

marius-wieschollek commented 1 month ago
Client error: POST [http://nextcloud-aio-imaginary:9000/info`](http://nextcloud-aio-imaginary:9000/info%60) resulted in a 401 Unauthorized response:\n{"message":"Invalid or missing API key","status":401}\n

There is the issue, NC has added api keys and passwords doesn't add the key to the request. I will add a patch for this.