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

I’ve installed Ninja v5.0.13-15 (btw, is there a reason Ninja doesn’t allow me to copy text from its interface?).

It’s on a LiteSpeed server (via CyberPanel / Litespeed combo). I’m using PHP 7.4.

The installation process appeared to be fine. Except that now I’m going through tconfiguring the application, and in some errors I get errors. Some actions cause a non-descriptive 500 error. An error box pops up, saying “An error occurred. (new line). 500:”
image

So far this occurs when I try to edit the invoice layout. SETTINGS > INVOICE DESIGN > CUSTOMIZE & PREVIEW. It ties to load the preview panel and the error pops up.

I’ve looked in the Laraval error logs at: /public_html/storage/logs/laravel.log

The errors that occur whilst performing this action on the front-end, are:

[2020-11-22 09:05:52] local.ERROR: Argument 1 passed to Symfony\Component\VarDumper\Server\Connection::__construct() must be of the type string, null given, called in /home/mydomain/public_html/vendor/beyondcode/laravel-dump-server/src/DumpServerServiceProvider.php on line 49 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Argument 1 passed to Symfony\\Component\\VarDumper\\Server\\Connection::__construct() must be of the type string, null given, called in /home/mydomain/public_html/vendor/beyondcode/laravel-dump-server/src/DumpServerServiceProvider.php on line 49 at /home/mydomain/public_html/vendor/symfony/var-dumper/Server/Connection.php:32)
[stacktrace]
#0 /home/mydomain/public_html/vendor/beyondcode/laravel-dump-server/src/DumpServerServiceProvider.php(49): Symfony\\Component\\VarDumper\\Server\\Connection->__construct()
#1 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(616): BeyondCode\\DumpServer\\DumpServerServiceProvider->register()
#2 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(75): Illuminate\\Foundation\\Application->register()
#3 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(593): Illuminate\\Foundation\\ProviderRepository->load()
#4 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php(17): Illuminate\\Foundation\\Application->registerConfiguredProviders()
#5 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(219): Illuminate\\Foundation\\Bootstrap\\RegisterProviders->bootstrap()
#6 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(156): Illuminate\\Foundation\\Application->bootstrapWith()
#7 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(140): Illuminate\\Foundation\\Http\\Kernel->bootstrap()
#8 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#9 /home/mydomain/public_html/public/index.php(57): Illuminate\\Foundation\\Http\\Kernel->handle()
#10 {main}
"}
[2020-11-22 09:06:01] local.ERROR: Argument 1 passed to Symfony\Component\VarDumper\Server\Connection::__construct() must be of the type string, null given, called in /home/mydomain/public_html/vendor/beyondcode/laravel-dump-server/src/DumpServerServiceProvider.php on line 49 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Argument 1 passed to Symfony\\Component\\VarDumper\\Server\\Connection::__construct() must be of the type string, null given, called in /home/mydomain/public_html/vendor/beyondcode/laravel-dump-server/src/DumpServerServiceProvider.php on line 49 at /home/mydomain/public_html/vendor/symfony/var-dumper/Server/Connection.php:32)
[stacktrace]
#0 /home/mydomain/public_html/vendor/beyondcode/laravel-dump-server/src/DumpServerServiceProvider.php(49): Symfony\\Component\\VarDumper\\Server\\Connection->__construct()
#1 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(616): BeyondCode\\DumpServer\\DumpServerServiceProvider->register()
#2 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(75): Illuminate\\Foundation\\Application->register()
#3 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(593): Illuminate\\Foundation\\ProviderRepository->load()
#4 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php(17): Illuminate\\Foundation\\Application->registerConfiguredProviders()
#5 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(219): Illuminate\\Foundation\\Bootstrap\\RegisterProviders->bootstrap()
#6 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(320): Illuminate\\Foundation\\Application->bootstrapWith()
#7 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#8 /home/mydomain/public_html/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#9 {main}
"}

I don’t see anything related to this error in the server error logs.

I get similar laravel errors when I try to change the “Attach PDF” setting in the Email settings, and click “save”.

On the front-end I get this error:
image

In the error log:

[2020-11-22 09:12:47] local.ERROR: Argument 1 passed to Symfony\Component\VarDumper\Server\Connection::__construct() must be of the type string, null given, called in /home/mydomain/public_html/vendor/beyondcode/laravel-dump-server/src/DumpServerServiceProvider.php on line 49 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Argument 1 passed to Symfony\\Component\\VarDumper\\Server\\Connection::__construct() must be of the type string, null given, called in /home/mydomain/public_html/vendor/beyondcode/laravel-dump-server/src/DumpServerServiceProvider.php on line 49 at /home/mydomain/public_html/vendor/symfony/var-dumper/Server/Connection.php:32)
[stacktrace]
#0 /home/mydomain/public_html/vendor/beyondcode/laravel-dump-server/src/DumpServerServiceProvider.php(49): Symfony\\Component\\VarDumper\\Server\\Connection->__construct()
#1 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(616): BeyondCode\\DumpServer\\DumpServerServiceProvider->register()
#2 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(75): Illuminate\\Foundation\\Application->register()
#3 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(593): Illuminate\\Foundation\\ProviderRepository->load()
#4 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php(17): Illuminate\\Foundation\\Application->registerConfiguredProviders()
#5 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(219): Illuminate\\Foundation\\Bootstrap\\RegisterProviders->bootstrap()
#6 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(156): Illuminate\\Foundation\\Application->bootstrapWith()
#7 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(140): Illuminate\\Foundation\\Http\\Kernel->bootstrap()
#8 /home/mydomain/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#9 /home/mydomain/public_html/public/index.php(57): Illuminate\\Foundation\\Http\\Kernel->handle()
#10 {main}
"}

UPDATE: I’d not checked the user side of the application. Only the /#/ admin side. I now see that I get a 500 error when trying to access the domain without the /#/ on it.

Can someone tell me what might be causing these issues?

Thank you.

Jonathan

Hi,

The latest version is 5.0.25, is there a reason you’re using an older version?

Which text in the app are you trying to copy, selection can be enabled.

Hi.
It’s because I started the install a couple of months ago. Came unstuck, and put it in the too-hard basket for a while, until I had time to look at it again. Which is now.

Regarding text, just the error messages that pop-up. It’s rare that any text can’t be highlighted and copied in websites, so thought I’d ask.

I can now add that Saving pretty much anything in the Admin is giving me the, “An error occurred. Error: please check that invoice Ninja v5 is installed on the server”. Whereas previously I was saving many settings on the site. So something changed with something I’ve done on the command line. Not sure what though.

For example, trying to add a product, or add a customer, etc.

I notice on the command line, I get this error when trying to do pretty much any composer command:

composer dump
Generating optimized autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In Connection.php line 32:

  Argument 1 passed to Symfony\Component\VarDumper\Server\Connection::__construct() must be of the type string, null given, called in /home/billing.inspiredearth.nz/public_ht
  ml/vendor/beyondcode/laravel-dump-server/src/DumpServerServiceProvider.php on line 49


Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

For the error messages there should be a ‘copy’ button, we’ll look into making the text selectable as well.

There have been many fixes since that version, can you please retest with the latest release?

Okay, thanks for the answers.
So, I should delete the current installation, and start from scratch?

Also, I notice there’s no recent (like in the last few years) instructions on installing V5, which include using Composer.

There’s a link in the help files to this, https://blog.technerdservices.com/index.php/2015/04/techpop-how-to-install-invoice-ninja-on-ubuntu-14-04/ , that’s over 5 years old. Is it current?

And I’m not sure why the download link says 4.5.21, yet the one I downloaded before and installed is 5.0.13-15. Am I missing something here?

You can try using the API command to update it, in newer versions there’s an option in the UI

curl -X POST 'https://domain.com/api/v1/self-update' \
-H "X-API-TOKEN:TOKEN" \
-H "X-Requested-With: XMLHttpRequest" \
-H "X-API-SECRET:SECRET" \
-H "X-API-PASSWORD:PASSWORD"

Have you seen the guides linked to here: https://invoiceninja.github.io/selfhost.html#installing-invoice-ninja

You can download v5 here:

Thanks. They look more current (that what I found on the docs.invoiceninja.com pages).

Where do I find the API key and password, etc.?

The docs link is for v4, we’re working on new docs for v5.

Not sure if your version supports it but you may be able to create a token on Settings > Account Management, otherwise you’ll need to find it in the database. The password is your login password and the secret can be optionally set in the .env file.

Unfortunately I can’t generate an API due to the same error reported above. Seems something’s rather broken with this installation. Not sure what.

I’ll start from scratch.

I’ve attempted repeating the GIT process, and same issue occurring. Does this error message tell you anything? It would seem there’s some kind of server connection failure, but I have no idea what. Rather new to all this.

$ composer update
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 0 updates, 0 removals
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 0 updates, 0 removals
Package asgrim/ofxparser is abandoned, you should avoid using it. No replacement was suggested.
Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested.
Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead.
Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Generating optimized autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In Connection.php line 32:

  Argument 1 passed to Symfony\Component\VarDumper\Server\Connection::__construct() must be of the type string, null given, called in /home/mydomain/public_ht
  ml/vendor/beyondcode/laravel-dump-server/src/DumpServerServiceProvider.php on line 49


Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

The specific error being,

In Connection.php line 32:

  Argument 1 passed to Symfony\Component\VarDumper\Server\Connection::__construct() must be of the type string, null given, called in /home/mydomain/public_ht
  ml/vendor/beyondcode/laravel-dump-server/src/DumpServerServiceProvider.php on line 49

One option is to use the prebuilt zip which doesn’t require composer

I found this issue which suggest some possible fixes: https://github.com/beyondcode/laravel-dump-server/issues/48

Note: you want to run composer install, unless you’re developing the app you shouldn’t run composer update

Thanks. I had previously found that thread, whilst trying to figure this issue out. But I didn’t see anything I felt applied to the situation.

However, this time I picked up one suggestion late in the thread, saying to run, composer upgrade --no-dev if I’d previously run composer upgrade (and screwed things up as a result of that).

Which brings me to question why the Composer instructions here say to use composer update?

https://invoiceninja.github.io/selfhost.html#installing-invoice-ninja

So I now seem to be a step further in the installation of the newer version.

I was able to get right through the Composer instructions on that page. But I still get this error when trying to save ANYTHING in the Admin.

image

I see this mentioned at the end of those instructions mentioned above:

Node / NPM version
As we are using the latest version of Puppeteer (v5), NPM version must be >= 6 and Node >=12

My Ubuntu 18.04 installation (after I forced it to upgrade to a much higher version, using instructions here) is running Nodejs v10.23.0. NPM v6.14.8

Is that likely to be an issue?

It’s a mistake in the docs, we’ll make sure it’s corrected.

Are you running the latest version now?

Hi. Yes, running latest version now. But still get the same error on in the Admin, and I notice I am now getting 403 error on front end. Which seems to have started happening after applying the suggested file permissions. E.g, from here.

$ sudo chown -R www-data:www-data /usr/share/nginx/invoiceninja
  $ sudo chmod -R g+s /usr/share/nginx/invoiceninja
  $ sudo chmod -R 775 /usr/share/nginx/invoiceninja/storage

Although it’s the same permissions spelt out in the various other guides.

.htaccess file

I’m wondering if perhaps the default Apache based .htaccess settings are not correct for OpenLiteSpeed?
The one page that explained how to install Ninja on OLS (I vaguely recall it was you who posted a link to it somewhere in these forums) was very outdated, and didn’t seem anything like the current .htaccess file, which is:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Do you know of any update-to-date info on this? (namely, correct .htaccess settings for Ninja v5 on OLS?)

Sorry, I’ve never heard of OpenLiteSpeed

Researching it now, looks interesting…

LiteSpeed server?
https://www.litespeedtech.com/

OpenLiteSpeed is the open source version of that. You’re mention of a link to some info on it was here: https://github.com/invoiceninja/invoiceninja/issues/93#issuecomment-643765687 (which is no longer linking to anything) … and also here, which does link to something.