Even small size custom logo makes Snappdf not working

  • Snappdf
  • Arch Linux
  • For test raised memory limit to 1.5 GB
  • Timeouts are already very generous

It works if I delete custom logo, both Flutter and React
Even a logo of 70-80 KB in size makes preview spinning endlessly and blank page.
Right after I delete custom logo PDF preview works fine and fast.

  • With hosted_ninja it is OK with custom logo, no matter size.
  • Invoices - View PDF works fine, fast and custom logo is there.

Do not know it this means something:
http://127.0.0.1:8000/api/v1/live_design

404 | Nothing to see here!

Chrome console error:

InvoiceViewer-b2260d02.js:1 t {message: 'canceled', name: 'CanceledError', code: 'ERR_CANCELED'}
(anonymous) @ InvoiceViewer-b2260d02.js:1
Promise.catch (async)
(anonymous) @ InvoiceViewer-b2260d02.js:1
Qr @ react-dom-1d34f3af.js:16
An @ react-dom-1d34f3af.js:16
uf @ react-dom-1d34f3af.js:16
an @ react-dom-1d34f3af.js:16
lo @ react-dom-1d34f3af.js:16
on @ react-dom-1d34f3af.js:14
(anonymous) @ react-dom-1d34f3af.js:16
axios-95debb6e.js:2     POST http://127.0.0.1:8000/api/v1/live_design 500 (Internal Server Error)
(anonymous) @ axios-95debb6e.js:2
G @ axios-95debb6e.js:2
it @ axios-95debb6e.js:2
_.request @ axios-95debb6e.js:2
(anonymous) @ axios-95debb6e.js:1
N @ index-ee651541.js:57
(anonymous) @ InvoiceViewer-b2260d02.js:1
Qr @ react-dom-1d34f3af.js:16
An @ react-dom-1d34f3af.js:16
(anonymous) @ react-dom-1d34f3af.js:16
C @ scheduler-04ce0582.js:9
L @ scheduler-04ce0582.js:9
InvoiceViewer-b2260d02.js:1 N {message: 'Request failed with status code 500', name: 'AxiosError', code: 'ERR_BAD_RESPONSE', config: {…}, request: XMLHttpRequest, …}code: "ERR_BAD_RESPONSE"config: {transitional: {…}, transformRequest: Array(1), transformResponse: Array(1), timeout: 0, adapter: ƒ, …}message: "Request failed with status code 500"name: "AxiosError"request: XMLHttpRequest {onreadystatechange: null, readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, …}response: {data: ArrayBuffer(33), status: 500, statusText: 'Internal Server Error', headers: {…}, config: {…}, …}[[Prototype]]: Error
(anonymous) @ InvoiceViewer-b2260d02.js:1
Promise.catch (async)
(anonymous) @ InvoiceViewer-b2260d02.js:1
Qr @ react-dom-1d34f3af.js:16
An @ react-dom-1d34f3af.js:16
(anonymous) @ react-dom-1d34f3af.js:16
C @ scheduler-04ce0582.js:9
L @ scheduler-04ce0582.js:9

Deep debug says me nothing special. Laravel log, latest lines cannot see time stamps:
(I just noticed my server is off for 2 hours.)

[2023-07-01 18:24:02] production.ERROR: The process "'/usr/bin/chromium' '--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' '--ignore-certificate-errors' '--print-to-pdf=/tmp/pdf_q2L9WX.pdf' '/tmp/html_Oqnv7p.html'" exceeded the timeout of 60 seconds. {"userId":1,"exception":"[object] (Symfony\\Component\\Process\\Exception\\ProcessTimedOutException(code: 0): The process \"'/usr/bin/chromium' '--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' '--ignore-certificate-errors' '--print-to-pdf=/tmp/pdf_q2L9WX.pdf' '/tmp/html_Oqnv7p.html'\" exceeded the timeout of 60 seconds. at /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/symfony/process/Process.php:1154)
[stacktrace]
#0 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/symfony/process/Process.php(423): Symfony\\Component\\Process\\Process->checkTimeout()
#1 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/symfony/process/Process.php(249): Symfony\\Component\\Process\\Process->wait()
#2 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/beganovich/snappdf/src/Snappdf.php(257): Symfony\\Component\\Process\\Process->run()
#3 /home/stagger-lee/web-development/www/html/invoice-ninja/app/Utils/Traits/Pdf/PdfMaker.php(44): Beganovich\\Snappdf\\Snappdf->generate()
#4 /home/stagger-lee/web-development/www/html/invoice-ninja/app/Services/Pdf/PdfService.php(146): App\\Services\\Pdf\\PdfService->makePdf()
#5 /home/stagger-lee/web-development/www/html/invoice-ninja/app/Services/Pdf/PdfMock.php(86): App\\Services\\Pdf\\PdfService->resolvePdfEngine()
#6 /home/stagger-lee/web-development/www/html/invoice-ninja/app/Http/Controllers/PreviewController.php(166): App\\Services\\Pdf\\PdfMock->getPdf()
#7 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\\Http\\Controllers\\PreviewController->design()
#8 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(43): Illuminate\\Routing\\Controller->callAction()
#9 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Routing/Route.php(259): Illuminate\\Routing\\ControllerDispatcher->dispatch()
#10 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Routing/Route.php(205): Illuminate\\Routing\\Route->runController()
#11 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Routing/Router.php(798): Illuminate\\Routing\\Route->run()
#12 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}()
#13 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(89): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#14 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(54): Illuminate\\Routing\\Middleware\\ThrottleRequests->handleRequestUsingNamedLimiter()
#15 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Routing\\Middleware\\ThrottleRequests->handle()
#16 /home/stagger-lee/web-development/www/html/invoice-ninja/app/Http/Middleware/QueryLogging.php(40): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#17 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): App\\Http\\Middleware\\QueryLogging->handle()
#18 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#19 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle()
#20 /home/stagger-lee/web-development/www/html/invoice-ninja/app/Http/Middleware/Locale.php(44): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#21 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): App\\Http\\Middleware\\Locale->handle()
#22 /home/stagger-lee/web-development/www/html/invoice-ninja/app/Http/Middleware/TokenAuth.php(101): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#23 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): App\\Http\\Middleware\\TokenAuth->handle()
#24 /home/stagger-lee/web-development/www/html/invoice-ninja/app/Http/Middleware/SetDb.php(40): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#25 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): App\\Http\\Middleware\\SetDb->handle()
#26 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#27 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Routing/Router.php(797): Illuminate\\Pipeline\\Pipeline->then()
#28 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Routing/Router.php(776): Illuminate\\Routing\\Router->runRouteWithinStack()
#29 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Routing/Router.php(740): Illuminate\\Routing\\Router->runRoute()
#30 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Routing/Router.php(729): Illuminate\\Routing\\Router->dispatchToRoute()
#31 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(190): Illuminate\\Routing\\Router->dispatch()
#32 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#33 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/livewire/livewire/src/DisableBrowserCache.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#34 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Livewire\\DisableBrowserCache->handle()
#35 /home/stagger-lee/web-development/www/html/invoice-ninja/app/Http/Middleware/Cors.php(24): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#36 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): App\\Http\\Middleware\\Cors->handle()
#37 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#38 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle()
#39 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#40 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#41 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#42 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#43 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#44 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
#45 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#46 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
#47 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#48 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#49 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#50 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(165): Illuminate\\Pipeline\\Pipeline->then()
#51 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(134): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#52 /home/stagger-lee/web-development/www/html/invoice-ninja/public/index.php(56): Illuminate\\Foundation\\Http\\Kernel->handle()
#53 /home/stagger-lee/web-development/www/html/invoice-ninja/vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php(16): require_once('...')
#54 {main}
"} 

Env file:

NINJA_ENVIRONMENT="selfhost"
APP_NAME="xxxxxxxxx"
APP_ENV=production
APP_KEY=base64:xxxxxxxxxxxx=
APP_DEBUG=false
#EXPANDED_LOGGING=true
#LOG_PDF_HTML=true
APP_URL="http://127.0.0.1:8000"
VITE_API_URL="http://localhost:5173/"
LOCAL_DOWNLOAD=true
REQUIRE_HTTPS="false"
DB_CONNECTION="mysql"
DB_DATABASE="db-ninja-01"
DB_USERNAME="ninja"
DB_PASSWORD="ninja"
PHANTOMJS_PDF_GENERATION=false
#options - snappdf / phantom / hosted_ninja
PDF_GENERATOR=snappdf
SNAPPDF_CHROMIUM_PATH=/usr/bin/chromium
DB_HOST="localhost"
DB_PORT="3306"
MAIL_MAILER="log"
MAIL_PORT=""
MAIL_ENCRYPTION="tls"
MAIL_HOST=""
MAIL_USERNAME=""
MAIL_FROM_NAME=""
MAIL_FROM_ADDRESS=""
MAIL_PASSWORD=""
{
    "message": "canceled",
    "name": "CanceledError",
    "code": "ERR_CANCELED",
    "status": null
}

axios-95debb6e.js:2     POST http://127.0.0.1:8000/api/v1/live_design 500 (Internal Server Error)

Hi,

Maybe the info here will help, it looks like a similar same issue.

Do not think it is my problem. CPU & RAM usage is fine, diks too.
Tried with hosted_ninja, numprocs=1, switch back to snappdf. The same problem.

(With hosted_ninja there is no custom logo inside Settings - Invoice preview. There is in real invoices.)

It is just custom logo. Without it works fast and OK.
Both storage folders have right permissions and owner.

I do not know if it is related. Deleting logo leaves it at the server in storage folder. Strange.

Adding LOCAL_DOWNLOAD=true to the .env file may help with the logo.

It is already inside.

If I change this:
APP_URL=“http://127.0.0.1:8000

to this:
APP_URL=“http://localhost/invoice-ninja

Invoice design preview works, but then wrong path for real Invoices.

@david do you have any suggestions?

It is not open_basedir. I just disabled it, restarted Apache to test. The same problem.

This sounds like a dns resolution issue from your machine not being able to resolve the path to the logo

I think you can hack around this by setting in your .env

IS_DOCKER=true

Sadly not. Thank you.