SUPLA / supla-cloud

https://www.supla.org
GNU General Public License v2.0
70 stars 46 forks source link

OCR: error in configuration is blocking all OCR server activities #875

Open fracz opened 2 months ago

fracz commented 2 months ago

After editing some OCR settings on Cloud, OCR server stopped working. There are following logs:

thrown in /var/www/supla-ocr/backend/src/Domain/Ocr/OcrImage.php on line 243
0/5 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0%PHP Fatal error: Uncaught TypeError: App\Domain\Ocr\OcrImage::getPhotoSettings(): Return value must be of type array, int returned in /var/www/supla-ocr/backend/src/Domain/Ocr/OcrImage.php:243
Stack trace:
#0 /var/www/supla-ocr/backend/src/Domain/Ocr/OcrImage.php(164): App\Domain\Ocr\OcrImage->getPhotoSettings()
#1 /var/www/supla-ocr/backend/src/Application/Cli/OcrCommand.php(70): App\Domain\Ocr\OcrImage->getCroppedImage()
#2 /var/www/supla-ocr/backend/vendor/symfony/console/Command/Command.php(298): App\Application\Cli\OcrCommand->execute()
#3 /var/www/supla-ocr/backend/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()
#4 /var/www/supla-ocr/backend/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#5 /var/www/supla-ocr/backend/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#6 /var/www/supla-ocr/backend/src/Application/Cli/DispatchCyclicTasksCommand.php(23): Symfony\Component\Console\Application->run()
#7 /var/www/supla-ocr/backend/vendor/symfony/console/Command/Command.php(298): App\Application\Cli\DispatchCyclicTasksCommand->execute()
#8 /var/www/supla-ocr/backend/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()
#9 /var/www/supla-ocr/backend/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#10 /var/www/supla-ocr/backend/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#11 /var/www/supla-ocr/backend/cli(11): Symfony\Component\Console\Application->run()
#12 {main}
thrown in /var/www/supla-ocr/backend/src/Domain/Ocr/OcrImage.php on line 243

According to OCR, config is empty: "{"photoSettings":0}" However on Cloud it was like this:

Image

Additional logs:

[2024-08-27T10:15:50.911572+02:00] app.log.ERROR: Slim Application Error Type: TypeError Code: 0 Message: App\Domain\Ocr\OcrImage::getPhotoSettings(): Return value must be of type array, int returned File: /var/www/supla-ocr/backend/src/Domain/Ocr/OcrImage.php Line: 243 Trace: #0 /var/www/supla-ocr/backend/src/Domain/Ocr/OcrImage.php(164): App\Domain\Ocr\OcrImage->getPhotoSettings() #1 /var/www/supla-ocr/backend/src/Application/Actions/App/GetLatestImageAction.php(43): App\Domain\Ocr\OcrImage->getCroppedImage() #2 /var/www/supla-ocr/backend/src/Application/Actions/Action.php(72): App\Application\Actions\App\GetLatestImageAction->action() #3 /var/www/supla-ocr/backend/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(38): App\Application\Actions\Action->__invoke() #4 /var/www/supla-ocr/backend/vendor/slim/slim/Slim/Routing/Route.php(363): Slim\Handlers\Strategies\RequestResponse->__invoke() #5 /var/www/supla-ocr/backend/vendor/slim/slim/Slim/MiddlewareDispatcher.php(73): Slim\Routing\Route->handle() #6 /var/www/supla-ocr/backend/vendor/slim/slim/Slim/MiddlewareDispatcher.php(73): Slim\MiddlewareDispatcher->handle() #7 /var/www/supla-ocr/backend/vendor/slim/slim/Slim/Routing/Route.php(321): Slim\MiddlewareDispatcher->handle() #8 /var/www/supla-ocr/backend/vendor/slim/slim/Slim/Routing/RouteRunner.php(74): Slim\Routing\Route->run() #9 /var/www/supla-ocr/backend/vendor/tuupola/slim-basic-auth/src/HttpBasicAuthentication.php(126): Slim\Routing\RouteRunner->handle() #10 /var/www/supla-ocr/backend/vendor/slim/slim/Slim/MiddlewareDispatcher.php(129): Tuupola\Middleware\HttpBasicAuthentication->process() #11 /var/www/supla-ocr/backend/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php(45): Psr\Http\Server\RequestHandlerInterface@anonymous->handle() #12 /var/www/supla-ocr/backend/vendor/slim/slim/Slim/MiddlewareDispatcher.php(129): Slim\Middleware\RoutingMiddleware->process() #13 /var/www/supla-ocr/backend/vendor/slim/slim/Slim/Middleware/BodyParsingMiddleware.php(65): Psr\Http\Server\RequestHandlerInterface@anonymous->handle() #14 /var/www/supla-ocr/backend/vendor/slim/slim/Slim/MiddlewareDispatcher.php(129): Slim\Middleware\BodyParsingMiddleware->process() #15 /var/www/supla-ocr/backend/vendor/slim/slim/Slim/Middleware/ErrorMiddleware.php(77): Psr\Http\Server\RequestHandlerInterface@anonymous->handle() #16 /var/www/supla-ocr/backend/vendor/slim/slim/Slim/MiddlewareDispatcher.php(129): Slim\Middleware\ErrorMiddleware->process() #17 /var/www/supla-ocr/backend/vendor/slim/slim/Slim/MiddlewareDispatcher.php(73): Psr\Http\Server\RequestHandlerInterface@anonymous->handle() #18 /var/www/supla-ocr/backend/vendor/slim/slim/Slim/App.php(209): Slim\MiddlewareDispatcher->handle() #19 /var/www/supla-ocr/backend/public/index.php(62): Slim\App->handle() #20 {main}

After deleting problematic photo on OCR server, it started to respond with "Unknown GUID". We had to remove device from Cloud and add it again. After that it again started to have problems with missing configuration. On Cloud "crop area" wasn't set:

Image

Setting crop area later, didn't fix the problem.