Ninja 5.x on Litespeed, installed, but get 500 error on some actions

You’re right, I don’t remember it. I often search for terms and copy/paste links

I understand.
Well, thanks for your help.
It looks like I’m not able to get InvoiceNinja running on this server, which throws a bit of a spanner into the works. I’ll have to come up with some other solution or way forward.
Regards… J

1 Like

Can you not serve the website with NGINX instead? I know my template for nginx configuration works with invoiceninja.

Thanks. :+1:
That’s exactly what I’m doing. The server I wanted it one happened to be running Cyberpanel (which is built on top of OpenLiteSpeed, which in theory should behave fairly similarly as Apache). But as I couldn’t figure out why it wasn’t working :roll_eyes:, I’m now in the process of setting it up on a different server, which happens to be running Nginx.

Where do I access your Nginx configuration template? Sounds like that might come in very handy.
:handshake:

Looks like I found it. These instructions?

This server doesn’t run Ubuntu, but some other Debian based build. Will the steps be much the same?

Linux version 4.9.0-11-amd64 (debian-kernel@lists.debian.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1) ) #1 SMP Debian 4.9.189-3+deb9u2 (2019-11-11)

Followed the Nginx instructions.
Something odd happened during web “Setup”.
PDF test was a success (first time I’ve managed that!).
All other tests were success (DB, Email, etc.).
Submitted the settings, and the page refreshed.
After that, PDF test failed.
I looked in the .env file and it was very incomplete. Missing much of what’s in the .env.example file, and what I’ve seen in the .env on my previous attempted installation.
My guess is that some error or bug occurred when I submitted the settings, and it wrote some settings in the .env (just the DB credentials, Mail credentials, URL, and perhaps a couple of other lines).

So I’ve put in many of the missing lines, manually.

The frustrating part is that I still can’t CUSTOMIZE AND PREVIEW invoices, etc. I get the non-descript 500 error.

The errors that show up in laravel.log when I try to activate the CUSTOMIZE AND PREVIEW are:

[2020-11-23 00:11:30] production.ERROR: The command "PATH=$PATH:/usr/local/bin NODE_PATH=`npm root -g` node '/home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/spatie/browsershot/src/../bin/browser.js' '{"url":"file:\/\/\/tmp\/694622329-0275510001606090288\/index.html","action":"pdf","options":{"args":["--no-sandbox"],"viewport":{"width":800,"height":600,"deviceScaleFactor":1},"displayHeaderFooter":false,"waitUntil":"networkidle0","printBackground":true}}'" failed.

Exit Code: 1(General error)

Working directory: /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/public

Output:
================


Error Output:
================
/home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/spatie/browsershot/bin/browser.js:20
const getOutput = async (page, request) => {
                        ^

SyntaxError: Unexpected token (
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.runMain (module.js:611:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:160:9)
 {"userId":1,"exception":"[object] (Symfony\\Component\\Process\\Exception\\ProcessFailedException(code: 0): The command \"PATH=$PATH:/usr/local/bin NODE_PATH=`npm root -g` node '/home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/spatie/browsershot/src/../bin/browser.js' '{\"url\":\"file:\\/\\/\\/tmp\\/694622329-0275510001606090288\\/index.html\",\"action\":\"pdf\",\"options\":{\"args\":[\"--no-sandbox\"],\"viewport\":{\"width\":800,\"height\":600,\"deviceScaleFactor\":1},\"displayHeaderFooter\":false,\"waitUntil\":\"networkidle0\",\"printBackground\":true}}'\" failed.

Exit Code: 1(General error)

Working directory: /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/public

Output:
================


Error Output:
================
/home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/spatie/browsershot/bin/browser.js:20
const getOutput = async (page, request) => {
                        ^

SyntaxError: Unexpected token (
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.runMain (module.js:611:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:160:9)
 at /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/spatie/browsershot/src/Browsershot.php:752)
[stacktrace]
#0 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/spatie/browsershot/src/Browsershot.php(539): Spatie\\Browsershot\\Browsershot->callBrowser(Array)
#1 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/app/Utils/Traits/Pdf/PdfMaker.php(44): Spatie\\Browsershot\\Browsershot->pdf()
#2 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/app/Jobs/Util/PreviewPdf.php(61): App\\Jobs\\Util\\PreviewPdf->makePdf(NULL, NULL, '<!DOCTYPE html ...')
#3 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Jobs\\Util\\PreviewPdf->handle()
#4 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#5 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#6 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#7 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(596): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#8 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\\Container\\Container->call(Array)
#9 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}(Object(App\\Jobs\\Util\\PreviewPdf))
#10 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(App\\Jobs\\Util\\PreviewPdf))
#11 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#12 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php(65): Illuminate\\Bus\\Dispatcher->dispatchNow(Object(App\\Jobs\\Util\\PreviewPdf))
#13 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/app/Http/Controllers/PreviewController.php(198): App\\Jobs\\Util\\PreviewPdf::dispatchNow('<!DOCTYPE html ...', Object(App\\Models\\Company))
#14 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/app/Http/Controllers/PreviewController.php(132): App\\Http\\Controllers\\PreviewController->blankEntity()
#15 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\\Http\\Controllers\\PreviewController->show()
#16 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction('show', Array)
#17 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(255): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(App\\Http\\Controllers\\PreviewController), 'show')
#18 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(197): Illuminate\\Routing\\Route->runController()
#19 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(691): Illuminate\\Routing\\Route->run()
#20 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#21 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/app/Http/Middleware/Locale.php(35): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#22 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\\Http\\Middleware\\Locale->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#23 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/app/Http/Middleware/TokenAuth.php(83): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#24 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\\Http\\Middleware\\TokenAuth->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#25 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/app/Http/Middleware/SetDb.php(41): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#26 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\\Http\\Middleware\\SetDb->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#27 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/app/Http/Middleware/Cors.php(34): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#28 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\\Http\\Middleware\\Cors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#29 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/app/Http/Middleware/QueryLogging.php(42): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#30 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\\Http\\Middleware\\QueryLogging->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#31 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#32 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#33 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(127): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#34 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(63): Illuminate\\Routing\\Middleware\\ThrottleRequests->handleRequest(Object(Illuminate\\Http\\Request), Object(Closure), Array)
#35 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Routing\\Middleware\\ThrottleRequests->handle(Object(Illuminate\\Http\\Request), Object(Closure), '300', '1')
#36 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#37 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(693): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#38 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(668): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#39 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(634): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#40 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(623): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#41 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(166): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#42 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#43 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/app/Http/Middleware/Cors.php(34): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#44 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\\Http\\Middleware\\Cors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#45 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#46 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#47 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#48 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#49 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#50 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#51 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#52 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#53 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(87): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#54 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#55 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Middleware.php(45): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#56 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Sentry\\Laravel\\Tracing\\Middleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#57 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#58 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(141): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#59 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#60 /home/436413.cloudwaysapps.com/ywqcfgpmty/public_html/public/index.php(57): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#61 {main}
"}

When I look in the browser console I see one error, that https://billing.mydomain.nz/api/v1/preview? generated a 500 error. If I try to directly access that URL I get a 404 (which might be irrelevant).

Further to the above, I’ve tried to View PDF on an invoice. It generates a PDF, but what the PDF contains is a screenshot of the login page!