v5 installed and running for a while now, with root access. But I was using PhantomJS and want to switch to snappdf. Getting a 500 error when trying to view/generate an invoice.
[previous exception] [object] (League\\Flysystem\\FileNotFoundException(code: 0): File not found at path: 9og9ratdqgqn6l9kww3ct7p4ejy9kw6k/YlVvdtALZPL6nbPetugvvIxcup8lDJqpWF6l59BJ/xercmejl863lo4dl9dh4tj3wd6qau6bb/invoices/2021-4387.pdf at /home/invoices/webapps/invoices/vendor/league/flysystem/src/Filesystem.php:390)
[stacktrace]
#0 /home/invoices/webapps/invoices/vendor/league/flysystem/src/Filesystem.php(180): League\Flysystem\Filesystem->assertPresent()
#1 /home/invoices/webapps/invoices/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php(152): League\Flysystem\Filesystem->read()
#2 /home/invoices/webapps/invoices/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php(398): Illuminate\Filesystem\FilesystemAdapter->get()
#3 /home/invoices/webapps/invoices/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\Filesystem\FilesystemManager->__call()
#4 /home/invoices/webapps/invoices/app/Http/Controllers/InvoiceController.php(811): Illuminate\Support\Facades\Facade::__callStatic()
#5 /home/invoices/webapps/invoices/vendor/symfony/http-foundation/StreamedResponse.php(109): App\Http\Controllers\InvoiceController->App\Http\Controllers\{closure}()
#6 /home/invoices/webapps/invoices/vendor/symfony/http-foundation/Response.php(394): Symfony\Component\HttpFoundation\StreamedResponse->sendContent()
#7 /home/invoices/webapps/invoices/public/index.php(61): Symfony\Component\HttpFoundation\Response->send()
#8 {main}
"}
.env settings:
NINJA_ENVIRONMENT=selfhost
PHANTOMJS_PDF_GENERATION=false
PHANTOMJS_KEY='....'
PHANTOMJS_SECRET=secret
NINJA_HOSTED_PDF=false
hillel
July 19, 2021, 2:28pm
2
@david @ben any suggestions?
david
July 19, 2021, 10:05pm
3
Drop to the command line and run
vendor/bin/snappdf convert --html="<html</html>" g.pdf
This will confirm snap is working by producing an empty pdf
looks like … chrome is not installed?
root@vps1:/home/invoices/webapps/invoices# ./vendor/bin/snappdf convert --html="<html" g.pdf
In Snappdf.php line 223:
The command “’/home/invoices/webapps/invoices/vendor/beganovich/snappdf/versions/902957-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-st
ages-before-draw’ ‘–no-first-run’ ‘–no-margins’ ‘–no-sandbox’ ‘–print-to-pdf-no-header’ ‘–hide-scrollbars’ ‘–ignore-certificate-errors’ ‘–print-to-pdf=/tmp/pdf_gfKKhT.pdf’ ‘/tmp/html_Wa4W
yH.html’” failed.
Exit Code: 127(Command not found)
Working directory: /home/invoices/webapps/invoices
Output:
Error Output:
/home/invoices/webapps/invoices/vendor/beganovich/snappdf/versions/902957-Linux_x64/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such
file or directory
convert [–url URL] [–html HTML] [–binary BINARY] [–]
tried this, no luck:
root@vps1:/home/invoices/webapps/invoices# ./vendor/bin/snappdf download
Chromium binary already downloaded. Provide --force to download again.
david
July 19, 2021, 10:52pm
6
@torch2k
Your missing some subsystem packages, have a look here for your flavour of linux:
Thank you. Packages are now installed, and I was able to generate a “g.pdf” as you requested. However, Invoice Ninja is still throwing a 500 error:
[2021-07-19 23:38:21] production.ERROR: File not found at path: p3j2r65rmb4vvxwy8vno5zbeguta92no/e13fAh56Y4MaINWN0oBDHA1yeLlG9DZrUX8zsfXl/db58xp37rge7xsfjbipdedc9zev4g6ev/invoices/R2021-2341.pdf {“exception”:"[object] (Illuminate\Contracts\Filesystem\FileNotFoundException(code: 0): File not found at path: p3j2r65rmb4vvxwy8vno5zbeguta92no/e13fAh56Y4MaINWN0oBDHA1yeLlG9DZrUX8zsfXl/db58xp37rge7xsfjbipdedc9zev4g6ev/invoices/R2021-2341.pdf at /home/invoices/webapps/invoices/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php:154)
[stacktrace]
#0 /home/invoices/webapps/invoices/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php(398): Illuminate\Filesystem\FilesystemAdapter->get()
#1 /home/invoices/webapps/invoices/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\Filesystem\FilesystemManager->__call()
#2 /home/invoices/webapps/invoices/app/Http/Controllers/InvoiceController.php(811): Illuminate\Support\Facades\Facade::__callStatic()
#3 /home/invoices/webapps/invoices/vendor/symfony/http-foundation/StreamedResponse.php(109): App\Http\Controllers\InvoiceController->App\Http\Controllers\{closure}()
#4 /home/invoices/webapps/invoices/vendor/symfony/http-foundation/Response.php(394): Symfony\Component\HttpFoundation\StreamedResponse->sendContent()
#5 /home/invoices/webapps/invoices/public/index.php(61): Symfony\Component\HttpFoundation\Response->send()
#6 {main}
[previous exception] [object] (League\Flysystem\FileNotFoundException(code: 0): File not found at path: p3j2r65rmb4vvxwy8vno5zbeguta92no/e13fAh56Y4MaINWN0oBDHA1yeLlG9DZrUX8zsfXl/db58xp37rge7xsfjbipdedc9zev4g6ev/invoices/R2021-2341.pdf at /home/invoices/webapps/invoices/vendor/league/flysystem/src/Filesystem.php:390)
[stacktrace]
#0 /home/invoices/webapps/invoices/vendor/league/flysystem/src/Filesystem.php(180): League\Flysystem\Filesystem->assertPresent()
#1 /home/invoices/webapps/invoices/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php(152): League\Flysystem\Filesystem->read()
#2 /home/invoices/webapps/invoices/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php(398): Illuminate\Filesystem\FilesystemAdapter->get()
#3 /home/invoices/webapps/invoices/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\Filesystem\FilesystemManager->__call()
#4 /home/invoices/webapps/invoices/app/Http/Controllers/InvoiceController.php(811): Illuminate\Support\Facades\Facade::__callStatic()
#5 /home/invoices/webapps/invoices/vendor/symfony/http-foundation/StreamedResponse.php(109): App\Http\Controllers\InvoiceController->App\Http\Controllers\{closure}()
#6 /home/invoices/webapps/invoices/vendor/symfony/http-foundation/Response.php(394): Symfony\Component\HttpFoundation\StreamedResponse->sendContent()
#7 /home/invoices/webapps/invoices/public/index.php(61): Symfony\Component\HttpFoundation\Response->send()
#8 {main}
"}
david
July 20, 2021, 9:46am
8
Could be a permissions error now, you may want to check the webuser can write to public/storage
@david I have a couple of new bits of info here.
my server is intended to have files and folders set to 644/755 permissions, respectively. InvoiceNinja wants to use 664/775 by default. I adjusted all permissions under /public/ and also adjusted /config/filesystems.php to match. This didn’t solve anything…
laravel.log states:
[2021-07-29 12:45:02] production.ERROR: File not found at path: 9og9ratdqgqn6l9kww3ct7p4ejy9kw6k/m243i3Cbm4Byak1nhje0NbyStq13tslnO7Oijrwe/isec80ccoc8nxaed9usmixq6mawhj1kx/invoices/2021-4414.pdf
However, when I navigate to ./public/storage/9og9ratdqgqn6l9kww3ct7p4ejy9kw6k/m243i3Cbm4Byak1nhje0NbyStq13tslnO7Oijrwe/isec80ccoc8nxaed9usmixq6mawhj1kx/invoices/, the invoice PDF is actually there.
Is there an issue with snappdf / ninja not using /public/storage/ in it’s path somehow?
from my /config/filesystems.php:
'public' => [
'driver' => 'local',
'root' => public_path('storage'),
//'root' => 'storage/',
// 'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
'permissions' => [
'file' => [
'public' => 0644,
'private' => 0600,
],
'dir' => [
'public' => 0755,
'private' => 0700,
],
],
],
david
July 29, 2021, 10:38pm
10
You may need to appen /publc to your APP_URL