TimeoutException when trying to save a new invoice

We just installed Invoice Ninja Version v5.3.85-W83 (self-hosted) and every time I want to save a new invoice (or delete a draft) I get a TimeoutException:
TimeoutException after 0:01:00.000000: Future not completed

Adding a new client (or product) on the other hand works fine.

Any idea what the problem could be?

Hi,

@david do you have any thoughts?

@plaschke

Most likely the timeout is due to the PDF not being created. You’ll want to ensure your PDFs are generating correctly (ie PhantomJS api key is configured) which will resolve this issue.

Thank you for the quick answer!
You are right, the problem seems to be generating the PDF:

[2022-05-10 10:08:25] production.ERROR: There was an error generating the PDF with Phantom JS {“exception”:"[object] (App\Exceptions\PhantomPDFFailure(code: 0): There was an error generating the PDF with Phantom JS at /var/www/html/invoiceninja/app/Utils/PhantomJS/Phantom.php:150)
[stacktrace]
#0 /var/www/html/invoiceninja/app/Utils/PhantomJS/Phantom.php(100): App\Utils\PhantomJS\Phantom->checkMime()
#1 /var/www/html/invoiceninja/app/Jobs/Entity/CreateEntityPdf.php(119): App\Utils\PhantomJS\Phantom->generate()
#2 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Jobs\Entity\CreateEntityPdf->handle()
#3 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#4 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#5 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#6 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call()
#7 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\Container\Container->call()
#8 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}()
#9 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#10 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then()
#11 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php(69): Illuminate\Bus\Dispatcher->dispatchNow()
#12 /var/www/html/invoiceninja/app/Services/Invoice/GetInvoicePdf.php(52): App\Jobs\Entity\CreateEntityPdf::dispatchNow()
#13 /var/www/html/invoiceninja/app/Services/Invoice/InvoiceService.php(187): App\Services\Invoice\GetInvoicePdf->run()
#14 /var/www/html/invoiceninja/app/Http/Controllers/InvoiceController.php(827): App\Services\Invoice\InvoiceService->getInvoicePdf()
#15 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\InvoiceController->downloadPdf()
#16 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction()
#17 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Routing/Route.php(262): Illuminate\Routing\ControllerDispatcher->dispatch()
#18 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Routing/Route.php(205): Illuminate\Routing\Route->runController()
#19 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Routing/Router.php(721): Illuminate\Routing\Route->run()
#20 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#21 /var/www/html/invoiceninja/app/Http/Middleware/QueryLogging.php(39): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#22 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\QueryLogging->handle()
#23 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#24 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Routing\Middleware\SubstituteBindings->handle()
#25 /var/www/html/invoiceninja/app/Http/Middleware/SetInviteDb.php(84): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#26 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\SetInviteDb->handle()
#27 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#28 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle()
#29 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#30 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\View\Middleware\ShareErrorsFromSession->handle()
#31 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#32 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle()
#33 /var/www/html/invoiceninja/app/Http/Middleware/SessionDomains.php(32): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#34 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\SessionDomains->handle()
#35 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#36 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Session\Middleware\StartSession->handleStatefulRequest()
#37 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Session\Middleware\StartSession->handle()
#38 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#39 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Cookie\Middleware\EncryptCookies->handle()
#40 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#41 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Routing/Router.php(723): Illuminate\Pipeline\Pipeline->then()
#42 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Routing/Router.php(698): Illuminate\Routing\Router->runRouteWithinStack()
#43 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Routing/Router.php(662): Illuminate\Routing\Router->runRoute()
#44 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Routing/Router.php(651): Illuminate\Routing\Router->dispatchToRoute()
#45 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(167): Illuminate\Routing\Router->dispatch()
#46 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()
#47 /var/www/html/invoiceninja/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Http/SetRequestIpMiddleware.php(45): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#48 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Sentry\Laravel\Http\SetRequestIpMiddleware->handle()
#49 /var/www/html/invoiceninja/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Http/SetRequestMiddleware.php(42): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#50 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Sentry\Laravel\Http\SetRequestMiddleware->handle()
#51 /var/www/html/invoiceninja/vendor/livewire/livewire/src/DisableBrowserCache.php(19): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#52 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Livewire\DisableBrowserCache->handle()
#53 /var/www/html/invoiceninja/app/Http/Middleware/Cors.php(25): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#54 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\Cors->handle()
#55 /var/www/html/invoiceninja/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#56 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\Proxy\TrustProxies->handle()
#57 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#58 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#59 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle()
#60 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#61 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#62 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TrimStrings->handle()
#63 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#64 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle()
#65 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#66 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle()
#67 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#68 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(142): Illuminate\Pipeline\Pipeline->then()
#69 /var/www/html/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(111): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()
#70 /var/www/html/invoiceninja/public/index.php(57): Illuminate\Foundation\Http\Kernel->handle()
#71 {main}
"}

We tried switching from Phantom JS to Snappdf but somehow that didn’t work.

Installing it through “composer require beganovich/snappdf” leads to problems with some dependencies (“Your requirements could not be resolved to an installable set of packages.”).

Are we missing something here? Anything else we need to do to use snappdf?
(apart from also setting PDF_GENERATOR=snappdf)