Invoice View Error 500

I have a v4 hosted on Shared Hosting Provider (Working with no issue).
I created a v5 hosted on same Shared Hosting Provider then do the migration using the migration tool.

My issue with v5 was that every time I view the Invoice PDF it says error 500

I already tried the following installation method but same error result

  1. Manual File zip extraction
  2. Git
  3. Git + Manual zip extraction

Here are some of the error logs from storage/logs/laravel.log

production.ERROR: The file “/home/customer/www/domain.com/public_html/public/storage/kLFW3io4djEDhQ73RA0PILtcTIFNoztf/UMOUTS5lc7j17b9YFzKYDaTFTmieHzfIw8FKBfNm/invoices/1167.pdf” does not exist {“exception”:"[object] (Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException(code: 0): The file "/home/customer/www/domain.com/public_html/public/storage/kLFW3io4djEDhQ73RA0PILtcTIFNoztf/UMOUTS5lc7j17b9YFzKYDaTFTmieHzfIw8FKBfNm/invoices/1167.pdf" does not exist at /home/customer/www/domain.com/public_html/vendor/symfony/http-foundation/File/File.php:36)
[stacktrace]

production.ERROR: Unable to open file for reading [https://domain.com/storage/kLFW3io4djEDhQ73RA0PILtcTIFNoztf/FxHGU8inf2Cm2xMebST3XJwDJPRuit6BDshwqtIQ/invoices/1133.pdf] {“userId”:1,“exception”:"[object] (Swift_IoException(code: 0): Unable to open file for reading [https://domain.com/storage/kLFW3io4djEDhQ73RA0PILtcTIFNoztf/FxHGU8inf2Cm2xMebST3XJwDJPRuit6BDshwqtIQ/invoices/1133.pdf] at /home/customer/www/domain.com/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php:131)
[stacktrace]

Does the PDF exist? If not, it’s probably a permissions problem on the storage folder.

Most likely if you are on shared hosting the issue is the PDFs are not generating, you may have been luck using phantomJS cloud to create the PDFs

@david Is there any documentation on how to integrate the panthomJS cloud to create the PDFs?

Thanks.

@hapopoy

yes we have info on Phantom JS here

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

@david
I’m able to integrate PhnatomJS but this is what showing everytime I view invoice.

Fixed.

I just paste the same PhantomJS API Key on PHANTOMJS_KEY and PHANTOMJS_SECRET

Thanks.

1 Like

Hi @david ,

Follow up question.
Invoice PDF is now working with PhantomJS but when we click on Delivery Note it give us error 500.
What the possible cause of this?

Error Output:

/home/customer/www/domain.com/public_html/vendor/beganovich/snappdf/versions/859006-Linux_x64/chrome-linux/chrome: error while loading shared libraries: libgbm.so.1: cannot open shared object file: No such file or directory
{“userId”:1,“exception”:"[object] (Symfony\Component\Process\Exception\ProcessFailedException(code: 0): The command "‘/home/customer/www/domain.com/public_html/vendor/beganovich/snappdf/versions/859006-Linux_x64/chrome-linux/chrome’ ‘–headless’ ‘–disable-gpu’ ‘–disable-translate’ ‘–disable-extensions’ ‘–disable-sync’ ‘–disable-background-networking’ ‘–disable-software-rasterizer’ ‘–disable-default-apps’ ‘–disable-dev-shm-usage’ ‘–safebrowsing-disable-auto-update’ ‘–run-all-compositor-stages-before-draw’ ‘–no-first-run’ ‘–no-margins’ ‘–no-sandbox’ ‘–print-to-pdf-no-header’ ‘–hide-scrollbars’ ‘–print-to-pdf=/tmp/pdf_LD7fq4.pdf’ ‘/tmp/html_0gGSG3.html’" failed.

Can you advise the error in the logs when you click on the delivery note please.

This is the error logs I got.

[2021-03-13 07:16:30] production.ERROR: The command “’/home/customer/www/domain.com/public_html/vendor/beganovich/snappdf/versions/859006-Linux_x64/chrome-linux/chrome’ ‘–headless’ ‘–disable-gpu’ ‘–disable-translate’ ‘–disable-extensions’ ‘–disable-sync’ ‘–disable-background-networking’ ‘–disable-software-rasterizer’ ‘–disable-default-apps’ ‘–disable-dev-shm-usage’ ‘–safebrowsing-disable-auto-update’ ‘–run-all-compositor-stages-before-draw’ ‘–no-first-run’ ‘–no-margins’ ‘–no-sandbox’ ‘–print-to-pdf-no-header’ ‘–hide-scrollbars’ ‘–print-to-pdf=/tmp/pdf_cpsLSS.pdf’ ‘/tmp/html_jS5tXQ.html’” failed.

Exit Code: 127(Command not found)

Working directory: /home/customer/www/domain.com/public_html/public

Output:

Error Output:

/home/customer/www/domain.com/public_html/vendor/beganovich/snappdf/versions/859006-Linux_x64/chrome-linux/chrome: error while loading shared libraries: libgbm.so.1: cannot open shared object file: No such file or directory
{“userId”:1,“exception”:"[object] (Symfony\Component\Process\Exception\ProcessFailedException(code: 0): The command “’/home/customer/www/domain.com/public_html/vendor/beganovich/snappdf/versions/859006-Linux_x64/chrome-linux/chrome’ ‘–headless’ ‘–disable-gpu’ ‘–disable-translate’ ‘–disable-extensions’ ‘–disable-sync’ ‘–disable-background-networking’ ‘–disable-software-rasterizer’ ‘–disable-default-apps’ ‘–disable-dev-shm-usage’ ‘–safebrowsing-disable-auto-update’ ‘–run-all-compositor-stages-before-draw’ ‘–no-first-run’ ‘–no-margins’ ‘–no-sandbox’ ‘–print-to-pdf-no-header’ ‘–hide-scrollbars’ ‘–print-to-pdf=/tmp/pdf_cpsLSS.pdf’ ‘/tmp/html_jS5tXQ.html’” failed.

Exit Code: 127(Command not found)

Working directory: /home/customer/www/domain.com/public_html/public

Output:

Error Output:

/home/customer/www/domain.com/public_html/vendor/beganovich/snappdf/versions/859006-Linux_x64/chrome-linux/chrome: error while loading shared libraries: libgbm.so.1: cannot open shared object file: No such file or directory
at /home/customer/www/domain.com/public_html/vendor/beganovich/snappdf/src/Snappdf.php:157)
[stacktrace]

[2021-03-13 07:20:02] production.ERROR: A non-numeric value encountered {“exception”:"[object] (ErrorException(code: 0): A non-numeric value encountered at /home/customer/www/domain.com/public_html/vendor/turbo124/beacon/src/Jobs/System/MemMetric.php:36)
[stacktrace]

Had the same error and because we do not have public domain cannot use PhantomJS.
Permissions set to 0755 to /vendor/beganovich - started showing PDF files

I have the same error. But the error only exists by delivery notes. Invoices will be shown correctly.