Self Hosted Error 500 When Updating to v5.3.74 with Correction Action

Environment: Production Invoice Ninja Self Hosted - version 5.3.68 being upgraded from the self update web console to v5.3.74
OS - Debian 10 server with current security patches (Linux)
PHP - v8.0.16 with current security patches
DataBase Engine - MySQL/MariaDB - Current version with latest security patches
Web Server - Apache v2.4.52 with current security patches
PDF Engine - Local SnapPDF (not using Phantom)
Other - Virtual Machine = yes
Other - VM is not Docker; private VM instance with dedicated resources

Error and Issue: Upgrading Invoice Ninja from v5.3.68 to v5.3.74 via the self update within the web application console. After the update is completed the webpage reloads and displays the 500 -server error page. From the SSH console of the instance, when trying to run sudo -u www-data php artisan optimize the command fails with the following error message

PHP Fatal error: Trait “Awobaz\Compoships\Compoships” not found in /var/www/html/invoiceninja/app/Models/Company.php on line 29

In Company.php line 29:

Trait “Awobaz\Compoships\Compoships” not found

Steps taken to correct this issue:

From the SSH console on the hosted instance I ran this command to correct the issue
sudo composer require mpyw/compoships-eager-limit

After this command completed, I was able to successfully run
sudo -u www-data php artisan optimize and the web console was reloaded without issue or error message. (Control + F5 to run a “hard” page reload)

Sources for correction of this issue were discovered here at the following links
https://github.com/staudenmeir/eloquent-eager-limit/issues/38
and
https://github.com/mpyw/compoships-eager-limit

3 Likes

Composer is not installed by default installation guides in most cases. If you are having issues running the above command, lookup the steps to install the composer or download the full .zip file of the latest build which includes the needed vendor files.

2 Likes

This seems to be the issue with the released update for Invoice Ninja. It seems the update could be re-released to include the necessary bits to complete the update without issue. The work around I provided will get admins back up and working until then.

  • Thanks all
1 Like

Hi,

Thanks for reporting this!

cc @david

For more information, please see here

Dear @david
What would you recommend in my case?
I downloaded the full release (v5.3.74, 216 MB) and copied the files over my existing installation. update?secret=secret led to an error 500. That’s the log report:

Have you ran /update?secret=secret

Hey David!
Thanks for your reply. Yes, I did - that’s when I’ve got the 500 error.

Same issue hier. Version 5.3.64 installed via Softaculous but when performing upgrade to version v5.3.74 in the app I got the error and even after manual overwritting all the files with v5.3.75 and performind the /update?secret= I still have the same issue.

I also get emails of my Artisan cronjob

In Company.php line 29:

Trait ‘Awobaz\Compoships\Compoships’ not found

Went back to version 5.3.64 via restore in my Softaculous and then performed update? again and then everything works fine. but get this notification

image

When when doing this it fails.

@lucaw @servitweb

Can you please delete the contents of bootstrap/cache

5.3.75 comes prebuilt with all dependencies so it sounds like something is loading from stale cache

1 Like

@david my log file above was with 5.3.74.
Let me try again with 5.3.75.

I’m having this issue,
But when I try this fix its says the following

Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See Deprecating Packagist.org support for Composer 1.x
Info from https://repo.packagist.org: #StandWithUkraine
Using version ^1.1 for mpyw/compoships-eager-limit
./composer.json has been updated
Loading composer repositories with package information
Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See Deprecating Packagist.org support for Composer 1.x
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies (including require-dev)
Killed

would anyone be able to help me?

I tried running the command composer self-update --2
but then I get the following error:

Command “self-update” is not defined.

@netspeario

That is the correct command

composer self-update --2

you may want to simply download the .phar again from the composer site and overwrite your current one.

Perfect. That worked. Thank you!

Just to be sure, we no longer need composer?
Same goes for curl I guess, because the updater downloads with git?

That worked for me! Thanks!

Thanks @amp51 and @gene