Failed jobs CallQueuedListener and CreateEntityPdf

Version 5.1.32

Hi, I have 2 jobs that run twice and keep failing. When I retry them, they directly will fail again.

ID Connection Queue Class Failed At
25 database default Illuminate\Events\CallQueuedListener 2021-04-01 10:42:51
24 database default Illuminate\Events\CallQueuedListener 2021-04-01 10:42:50
23 database default App\Jobs\Entity\CreateEntityPdf 2021-04-01 10:42:33
22 database default App\Jobs\Entity\CreateEntityPdf 2021-04-01 10:42:31

When I retry one of the jobs, I get this error in the Laravel.log. The error message is the same in both cases.

[2021-04-01 11:25:34] production.ERROR: Trying to get property 'type_id' of non-object {"exception":"[object] (ErrorException(code: 0): Trying to get property 'type_id' of non-object at /var/www/invoiceninja/app/Services/PdfMaker/Design.php:254)
[stacktrace]
#0 /var/www/invoiceninja/app/Services/PdfMaker/Design.php(254): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 [internal function]: App\\Services\\PdfMaker\\Design->App\\Services\\PdfMaker\\{closure}()
#2 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Collections/Arr.php(664): array_filter()
#3 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(344): Illuminate\\Support\\Arr::where()
#4 /var/www/invoiceninja/app/Services/PdfMaker/Design.php(255): Illuminate\\Support\\Collection->filter()
#5 /var/www/invoiceninja/app/Services/PdfMaker/Design.php(111): App\\Services\\PdfMaker\\Design->productTable()
#6 /var/www/invoiceninja/app/Jobs/Entity/CreateEntityPdf.php(146): App\\Services\\PdfMaker\\Design->elements()
#7 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Jobs\\Entity\\CreateEntityPdf->handle()
#8 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#9 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#10 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#11 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(611): Illuminate\\Container\\BoundMethod::call()
#12 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\\Container\\Container->call()
#13 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()
#14 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#15 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then()
#16 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(118): Illuminate\\Bus\\Dispatcher->dispatchNow()
#17 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}()
#18 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#19 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(120): Illuminate\\Pipeline\\Pipeline->then()
#20 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware()
#21 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\\Queue\\CallQueuedHandler->call()
#22 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(410): Illuminate\\Queue\\Jobs\\Job->fire()
#23 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(360): Illuminate\\Queue\\Worker->process()
#24 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(158): Illuminate\\Queue\\Worker->runJob()
#25 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(117): Illuminate\\Queue\\Worker->daemon()
#26 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#27 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle()
#28 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#29 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#30 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#31 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(611): Illuminate\\Container\\BoundMethod::call()
#32 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\\Container\\Container->call()
#33 /var/www/invoiceninja/vendor/symfony/console/Command/Command.php(256): Illuminate\\Console\\Command->execute()
#34 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\\Component\\Console\\Command\\Command->run()
#35 /var/www/invoiceninja/vendor/symfony/console/Application.php(971): Illuminate\\Console\\Command->run()
#36 /var/www/invoiceninja/vendor/symfony/console/Application.php(290): Symfony\\Component\\Console\\Application->doRunCommand()
#37 /var/www/invoiceninja/vendor/symfony/console/Application.php(166): Symfony\\Component\\Console\\Application->doRun()
#38 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Console/Application.php(92): Symfony\\Component\\Console\\Application->run()
#39 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\\Console\\Application->run()
#40 /var/www/invoiceninja/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#41 {main}
"} 

What can I do to fix this?

Thanks a lot!
Gijs

When I run php /var/www/invoiceninja/artisan queue:work I get this.

[2021-04-01 11:35:15][564] Processed:  App\Jobs\Util\SchedulerCheck
[2021-04-01 11:35:15][565] Processing: App\Jobs\Entity\CreateEntityPdf
[2021-04-01 11:35:16][565] **Failed**:     App\Jobs\Entity\CreateEntityPdf
[2021-04-01 11:35:16][566] Processing: App\Listeners\Invoice\UpdateInvoiceActivity
[2021-04-01 11:35:16][566] **Failed**:     App\Listeners\Invoice\UpdateInvoiceActivity
[2021-04-01 11:35:17][567] Processing: App\Jobs\Entity\CreateEntityPdf
[2021-04-01 11:35:17][567] **Failed**:     App\Jobs\Entity\CreateEntityPdf
[2021-04-01 11:35:18][568] Processing: App\Listeners\Invoice\UpdateInvoiceActivity
[2021-04-01 11:35:18][568] **Failed**:     App\Listeners\Invoice\UpdateInvoiceActivity
[2021-04-01 11:35:18][569] Processing: App\Jobs\Util\VersionCheck

App\Jobs\Entity\CreateEntityPdf and App\Listeners\Invoice\UpdateInvoiceActivity are the ones failing.

Hi,

Thanks for reporting this!

@david do you have any thoughts?

1 Like

@ben how are you initializing $this->entity in the Design class? And how are we dealing with null $entities in there?

1 Like

@david

app/Jobs/Entity/CreateEntityPdf.php:143
app/Services/PdfMaker/Designs/Utilities/DesignHelpers.php:35

@ecomsilio

Iā€™m not sure what has happened here. I think as it is just the entity creation, it is safe to remove these jobs

php artisan queue:flush