R0Wi-DEV / workflow_ocr

This is a Nextcloud Workflow App which enables you to process files via OCR on serverside.
GNU Affero General Public License v3.0
79 stars 6 forks source link

Error: Call to a member function getPath() on null #221

Closed robsmy98 closed 1 year ago

robsmy98 commented 1 year ago

After the Update from 27.0.1 to 27.0.2 I get this message 10 times in 1 minute in my protocol:

[workflow_ocr] Fehler: Error: Call to a member function getPath() on null at <<closure>>

0. /var/www/html/custom_apps/workflow_ocr/lib/Notification/Notifier.php line 98
   OCA\WorkflowOcr\Notification\Notifier->getRichParamForFile(["OC\\Notification\\Notification"])
1. /var/www/html/lib/private/Notification/Manager.php line 368
   OCA\WorkflowOcr\Notification\Notifier->prepare(["OC\\Notification\\Notification"], "de")
2. /var/www/html/apps/notifications/lib/Controller/EndpointController.php line 108
   OC\Notification\Manager->prepare(["OC\\Notification\\Notification"], "de")
3. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 230
   OCA\Notifications\Controller\EndpointController->listNotifications("v2")
4. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 137
   OC\AppFramework\Http\Dispatcher->executeController(["OCA\\Notificat ... "], "listNotifications")
5. /var/www/html/lib/private/AppFramework/App.php line 183
   OC\AppFramework\Http\Dispatcher->dispatch(["OCA\\Notificat ... "], "listNotifications")
6. /var/www/html/lib/private/Route/Router.php line 315
   OC\AppFramework\App::main("OCA\\Notificati ... r", "listNotifications", ["OC\\AppFramewo ... "], ["v2","ocs.notif ... "])
7. /var/www/html/ocs/v1.php line 64
   OC\Route\Router->match("/ocsapp/apps/no ... s")
8. /var/www/html/ocs/v2.php line 23
   require_once("/var/www/html/ocs/v1.php")

GET /ocs/v2.php/apps/notifications/api/v2/notifications?format=json

System

Server log

{"reqId":"XXXXX","level":3,"time":"2023-08-14T09:10:08+00:00","remoteAddr":"XXXXXXX","user":"XXXXXXX","app":"workflow_ocr","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications?format=json","message":"Call to a member function getPath() on null","userAgent":"Mozilla/5.0 (Windows) mirall/3.9.2stable-Win64 (build 20230808) (Nextcloud, windows-10.0.22621 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"27.0.2.1","exception":{"Exception":"Error","Message":"Call to a member function getPath() on null","Code":0,"Trace":[{"file":"/var/www/html/custom_apps/workflow_ocr/lib/Notification/Notifier.php","line":98,"function":"getRichParamForFile","class":"OCA\\WorkflowOcr\\Notification\\Notifier","type":"->","args":[["OC\\Notification\\Notification"]]},{"file":"/var/www/html/lib/private/Notification/Manager.php","line":368,"function":"prepare","class":"OCA\\WorkflowOcr\\Notification\\Notifier","type":"->","args":[["OC\\Notification\\Notification"],"de"]},{"file":"/var/www/html/apps/notifications/lib/Controller/EndpointController.php","line":108,"function":"prepare","class":"OC\\Notification\\Manager","type":"->","args":[["OC\\Notification\\Notification"],"de"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"listNotifications","class":"OCA\\Notifications\\Controller\\EndpointController","type":"->","args":["v2"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Notifications\\Controller\\EndpointController"],"listNotifications"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Notifications\\Controller\\EndpointController"],"listNotifications"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Notifications\\Controller\\EndpointController","listNotifications",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["v2","ocs.notifications.Endpoint.listNotifications"]]},{"file":"/var/www/html/ocs/v1.php","line":64,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/ocsapp/apps/notifications/api/v2/notifications"]},{"file":"/var/www/html/ocs/v2.php","line":23,"args":["/var/www/html/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/html/custom_apps/workflow_ocr/lib/Notification/Notifier.php","Line":111,"message":"Call to a member function getPath() on null","exception":{},"CustomMessage":"Call to a member function getPath() on null"}}
R0Wi commented 1 year ago

Thank's for reporting this. I also saw these messages on my dev machine but I thought they are related to some test data I created earlier. Will try to dig deeper into that ASAP.

R0Wi commented 1 year ago

@robsmy98 I think I found a fix for that. Would you mind testing the current patch from https://github.com/R0Wi-DEV/workflow_ocr/suites/15285716874/artifacts/872905928 ?

robsmy98 commented 1 year ago

I could try it in one week, thank you in advance :)

Robin Windey @.***> schrieb am So. 20. Aug. 2023 um 22:17:

@robsmy98 https://github.com/robsmy98 I think I found a fix for that. Would you mind testing the current patch from https://github.com/R0Wi-DEV/workflow_ocr/suites/15285716874/artifacts/872905928 ?

— Reply to this email directly, view it on GitHub https://github.com/R0Wi-DEV/workflow_ocr/issues/221#issuecomment-1685385778, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWF3UIMTY6GRNXREWD6WO2DXWJWHDANCNFSM6AAAAAA3PNDKDU . You are receiving this because you were mentioned.Message ID: @.***>

JakeAi commented 1 year ago

@robsmy98 I think I found a fix for that. Would you mind testing the current patch from https://github.com/R0Wi-DEV/workflow_ocr/suites/15285716874/artifacts/872905928 ?

That seemed to work for me.

farhills commented 1 year ago

I had the same issue for a single file, single user.

Before Patch: image

After Patch: image

Much better! To solve the actual issue, I had to ssh into the DB and delete the offending entry from oc_jobs. Hopefully that helps the next person getting spammed in the logs.

R0Wi commented 1 year ago

Thanks for your feedback @farhills! Even though I could not reproduce this behaviour after the patch, I added a migration step which should remove the pending Notifications when upgrading to the next app version.

Fix will be shipped with v1.27.2