Error 500 when generating PDF's on shared hosting

Hi,

I created a new install of v5 to test it out before i make my move. Everything seems to work fine except for the PDF.

When i click on View PDF or i try to send an email it gives me 500: Internal Server Error

Like i said this is on a shared hosting, i have SSH access and so on but of course its not like having root access on a VPS or a dedicated server.

Any help is appreciated.

This is what shows in the log file:

[2021-03-05 22:36:47] production.ERROR: The file “/home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/public/storage/YtsM0Sd2TNUC0fYODQik4oSvBk2uP4dpyHuw9U5NjTldbInqABVVSDgFFy5IR1YW/nG2ZE6gtRoBIDnzEF1l8JCgATncE3wbGranjsEYO/invoices/INV-000080.pdf” does not exist {“exception”:"[object] (Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException(code: 0): The file “/home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/public/storage/YtsM0Sd2TNUC0fYODQik4oSvBk2uP4dpyHuw9U5NjTldbInqABVVSDgFFy5IR1YW/nG2ZE6gtRoBIDnzEF1l8JCgATncE3wbGranjsEYO/invoices/INV-000080.pdf” does not exist at /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/symfony/http-foundation/File/File.php:36)
[stacktrace]
#0 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/symfony/http-foundation/BinaryFileResponse.php(93): Symfony\Component\HttpFoundation\File\File->__construct(’/home/clients/1…’)
#1 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/symfony/http-foundation/BinaryFileResponse.php(51): Symfony\Component\HttpFoundation\BinaryFileResponse->setFile(’/home/clients/1…’, ‘attachment’, false, true)
#2 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php(165): Symfony\Component\HttpFoundation\BinaryFileResponse->__construct(’/home/clients/1…’, 200, Array, true, ‘attachment’)
#3 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/app/Http/Controllers/InvoiceController.php(795): Illuminate\Routing\ResponseFactory->download(’/home/clients/1…’, ‘INV-000080.pdf’)
#4 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\InvoiceController->downloadPdf(‘jHrsJAqHGFUt1zA…’)
#5 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction(‘downloadPdf’, Array)
#6 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Routing/Route.php(254): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\InvoiceController), ‘downloadPdf’)
#7 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Routing/Route.php(197): Illuminate\Routing\Route->runController()
#8 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(693): Illuminate\Routing\Route->run()
#9 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#10 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/app/Http/Middleware/SetInviteDb.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#11 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\SetInviteDb->handle(Object(Illuminate\Http\Request), Object(Closure))
#12 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/app/Http/Middleware/QueryLogging.php(38): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#13 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\QueryLogging->handle(Object(Illuminate\Http\Request), Object(Closure))
#14 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#15 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#16 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#17 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#18 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#19 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#20 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#21 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(63): Illuminate\Session\Middleware\StartSession->handleStatefulRequest(Object(Illuminate\Http\Request), Object(Illuminate\Session\Store), Object(Closure))
#22 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#23 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#24 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#25 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#26 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#27 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#28 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(695): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#29 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(670): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#30 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(636): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#31 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(625): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#32 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(166): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#33 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#34 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/app/Http/Middleware/Cors.php(34): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#35 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\Cors->handle(Object(Illuminate\Http\Request), Object(Closure))
#36 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#37 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
#38 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#39 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#40 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#41 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#42 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#43 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
#44 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#45 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(Object(Illuminate\Http\Request), Object(Closure))
#46 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Middleware.php(46): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#47 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Sentry\Laravel\Tracing\Middleware->handle(Object(Illuminate\Http\Request), Object(Closure))
#48 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#49 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(141): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#50 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#51 /home/clients/15f153e506bfcee02335069cf4812c82/sites/invoices.my-domain.com/public/index.php(57): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#52 {main}
"}

Hey there, thanks for reporting this. Since you’re on the shared hosting, most likely some system-level dependencies are missing. You can try switching to Phantom & see how it goes:

https://invoiceninja.github.io/docs/self-host-troubleshooting/#phantom-js

Thanks, I’ll give it a try.

I have v4 running on the same host, i assume it is different than?

Yes, v5 is a complete rewrite. The PDF system in particular is very different than before, in v4 we used a JavaScript based solution which was created in the browser whereas in v5 the PDFs are built using HTML/CSS on the server.

Ah… makes sense…

What are the dependencies needed? Maybe i can get the hosting company to install/enable them.

You can find the details here:

Note: alternatively, the app stills supports using PhantomJS Cloud

https://invoiceninja.github.io/docs/self-host-troubleshooting/#phantom-js

Yup, ben already recommended it. I just prefer if i run things locally first.

Thanks for the help, hillel and ben. I will try PhantomJS and let you know.

PhantomJS worked fine. A bit laggy but it worked :slight_smile:

Instead of opening a new topic, i wanted to ask about the Invoice Terms

If i add my terms, i can only add it in a single line, i cant create separate lines and paragraphs. Is this normal or do i have to use html code or something?

It may help to add <br/> to add line breaks.

@ben, can/should we support line breaks in this field?

I tried that, it doesnt work.

And when i create an invoice and i click on the Invoice Terms, my pre-defined would show up greyed out but then it would not save.

And of course for people like me who dont know much about coding it would be better if you add line breaks like in v4 :stuck_out_tongue_winking_eye:

Hey there, using demo.invoiceninja.com:

image

@ben

Thanks for the reply.

Yeah, within the invoice itself i can do that, but if you go to Company > Defaults and try to change the Invoice Terms from there to be the default, you cant.

I have my information and bank details for payment under the Invoice Terms so in v4 they are automatically inserted, thats what im trying to do with the v5 so i dont have to look for the info and copy/paste it with every invoice.

If that makes sense…

Sorry, I didn’t get it on first.

@hillel invoice terms already have support for line breaks on PDF. However, the input field in the admin panel (in company defaults) is one line only. Can you make it multiline?

Sure, I’ll make the change.

Thanks!

Thank you both.

It would be grateful if you can update this thread when yo make the change.

If you make any changes will it be included with an update?

This changes will be included with the next release.

Great, thanks a lot for the help.