Self-hosted Invoice ninja fails to load after update

Hi guys,

Please forgive me for not having the version numbers as I did not write them down and I am unable to see what they are. I do recall there being a version file somewhere but I can’t seem to find it.

All I did was logged into my invoiceninja portal as my admin user, I saw the little orange triangle in the bottom left and I clicked it, it showed the current version and the version it was upgrading to and I did not take note of them as I have never had any issues before. This is with version 5 of invoice ninja. Below I have provided the web server error.log for this issue. When I try to load the site, I get a 500 error saying this page is not working however, the error does not match any of the error conditions I have seen on the troubleshooting page. Can someone please advise me on how I might go about fixing this without losing any data in the database as this would severely screw up my accounting?

I am currently running PHP 7.4.3 , I do believe many servers are deprecating this version of PHP, is this the case here? Should I upgrade to version 8.x?

Thank you!

Systops

Here are the entries in the log file: /var/log/nginx/ininja.error.log

root@portal:/etc# tail /var/log/nginx/ininja.error.log
#4 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(112): Illuminate\Foundation\Http\Kernel->reportException()
#5 /usr/share/nginx/invoiceninja/public/index.php(57): Illuminate\Found" while reading response header from upstream, client: 192.241.xxx.xxx, server: portal.systopiansolutions.com, request: “GET /actuator/health HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php-fpm.sock:”, host: “207.xxx.xxx.xxxx”
2022/11/09 14:49:12 [error] 1729197#1729197: *55137 FastCGI sent in stderr: “PHP message: PHP Notice: Trying to access array offset on value of type null in /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Schema.php on line 45PHP message: PHP Fatal error: Uncaught Error: Call to a member function connection() on null in /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Schema.php:45
Stack trace:
#0 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(166): Illuminate\Support\Facades\Schema::getFacadeAccessor()
#1 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(255): Illuminate\Support\Facades\Facade::getFacadeRoot()
#2 /usr/share/nginx/invoiceninja/app/Exceptions/Handler.php(80): Illuminate\Support\Facades\Facade::__callStatic()
#3 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(404): App\Exceptions\Handler->report()
#4 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(112): Illuminate\Foundation\Http\Kernel->reportException()
#5 /usr/share/nginx/invoiceninja/public/index.php(57): Illuminate\Found” while reading response header from upstream, client: 157.xxx.xxx.xxx, server: portal.systopiansolutions.com, request: “GET / HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php-fpm.sock:”, host: “portal.systopiansolutions.com”, referrer: “http://207.xxx.xxx.xxx/

Ffor my security I have xxx out the IP addresses.

Hi,

The latest v5.5.x version of the app requires PHP 8.1

Hi Hillel,

My bad, I missed that part however, I have gone ahead and upgraded my server to php8.1, however I am now seeing the following error when going through the instructions in how to upgrade IN5.5.x to php8.1.

I was able to get through all of the steps but then when it came down to doing the optimize on artisanI am seeing the following error. I have never seen this one before, and the site is still down. I am not too sure where to go from here. I am sorry, I know that as self-hosted servers, we really aren’t supported, but I need to get this up and running because with it down, I have no way to access my 20221 and 2022 accounting. Have I missed a step somewhere?

When I look at the versions.txt file it shows 5.5.37. So it looks like Invoice Ninja has updated itself, but for some reason, I can’t get the webserver to respond. I have made all the appropriate changes to the php.ini for php8.1, and PHP -v shows that I am not using php8.1, so I am unclear what or where I am missing something.

As always your generosity and assistance here are greatly appreciated.

root@portal:/usr/share/nginx/invoiceninja# sudo -u www-data php artisan optimize
PHP Warning: Trying to access array offset on value of type null in /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Schema.php on line 45
PHP Fatal error: Uncaught Error: Call to a member function connection() on null in /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Schema.php:45
Stack trace:
#0 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(166): Illuminate\Support\Facades\Schema::getFacadeAccessor()
#1 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(255): Illuminate\Support\Facades\Facade::getFacadeRoot()
#2 /usr/share/nginx/invoiceninja/app/Exceptions/Handler.php(80): Illuminate\Support\Facades\Facade::__callStatic()
#3 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(366): App\Exceptions\Handler->report()
#4 /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\Foundation\Console\Kernel->reportException()
#5 /usr/share/nginx/invoiceninja/artisan(37): Illuminate\Foundation\Console\Kernel->handle()
#6 {main}
thrown in /usr/share/nginx/invoiceninja/vendor/laravel/framework/src/Illuminate/Support/Facades/Schema.php on line 45

Many thanks,

John aka Systops

Maybe this will help?

The latest version should be reporting at least 5.5.41/42 so if you are seeing 5.5.37 it sounds like the package is not unzipping correctly.

I would download the latest release from GitHub - invoiceninja/invoiceninja: Invoices, Expenses and Tasks built with Laravel, Flutter and React

invoiceninja.zip

and unzip the contents and overwriting your existing setup. Just ensure to make a backup of your .env file prior to this.

After copying the files, run /update?secret=secret in the browser.