After the latest update of InvoiceNinja (running on php v7.4.28) I started to encounter this error after saving settings or changes:
500: Server Error
I checked the /storage/logs and there is only the laravel.log that shows:
[2022-03-08 13:43:03] production.ERROR: Cannot declare class Onboarding, because the name is already in use {“exception”:"[object] (Symfony\Component\ErrorHandler\Error\FatalError(code: 0): Cannot declare class Onboarding, because the name is already in use at /home/user/invoice.mydomain.nl/database/migrations/2021_11_08_131308_onboarding.php:0)
[stacktrace] #0 {main}
"}
I tried to force update through the GUI but than I get the following error:
XMLHttpRequest error.
If I save something with the webdev tools open in Chrome on the Console or Network tab I get an 500 error for:
Ok, unfortunately I celebrated a bit too early. Yesterday I had no issues but today the same thing started again.
If I check my chrome web tools output again, I get for the following url: Failed to load resource: the server responded with a status of 500 ()
Would it be an issue with the Request Method? Any help would be highly appreciated. If I can do anything to provide more information, please let me know.
In the root folder of my InvoiceNinja there is error_log which only has this inside:
PHP Notice: Constant PASSWORD_DEFAULT already defined in /home/myuser/invoice.mydomain.nl/update_pass.php on line 17
I didn’t change anything about the default installation through Softaculous on cPanel. (So I didn’t put ‘PUT’ to the company?)
In the /public/ folder the error_log has this inside:
PHP Fatal error: Cannot declare class Onboarding, because the name is already in use in /home/myuser/invoice.mydomain.nl/database/migrations/2021_11_08_131308_onboarding.php on line 0
In the cPanel logfile (/home/user/log/) this is the output:
and replace all the contents with the following please.
<?php
return new class extends Migration
{
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (!Schema::hasColumn('accounts', 'is_onboarding'))
{
Schema::table('accounts', function (Blueprint $table) {
$table->boolean('is_onboarding')->default(false);
});
}
if (!Schema::hasColumn('accounts', 'onboarding'))
{
Schema::table('accounts', function (Blueprint $table) {
$table->mediumText('onboarding')->nullable();
});
}
}
};
[2022-03-11 00:01:00][990] Processing: App\Jobs\Util\VersionCheck
[2022-03-11 00:01:01][990] Processed: App\Jobs\Util\VersionCheck
[2022-03-11 00:01:01][995] Processing: App\Jobs\Util\SchedulerCheck
PHP Fatal error: Cannot declare class Onboarding, because the name is already in use in
l/database/migrations/2021_11_08_131308_onboarding.php on line 7
Symfony\Component\ErrorHandler\Error\FatalError
Cannot declare class Onboarding, because the name is already in use
at database/migrations/2021_11_08_131308_onboarding.php:7
3▕ use Illuminate\Database\Migrations\Migration;
4▕ use Illuminate\Database\Schema\Blueprint;
5▕ use Illuminate\Support\Facades\Schema;
6▕
➜ 7▕ class Onboarding extends Migration
8▕ {
9▕ /**
10▕ * Run the migrations.
11▕ *
Whoops\Exception\ErrorException
Cannot declare class Onboarding, because the name is already in use
at database/migrations/2021_11_08_131308_onboarding.php:7
3▕ use Illuminate\Database\Migrations\Migration;
4▕ use Illuminate\Database\Schema\Blueprint;
5▕ use Illuminate\Support\Facades\Schema;
6▕
➜ 7▕ class Onboarding extends Migration
8▕ {
9▕ /**
10▕ * Run the migrations.
11▕ *
e[2m+1 vendor frames e[22m
2 [internal]:0
Whoops\Run::handleShutdown()
[11-Mar-2022 00:00:09 UTC] PHP Fatal error: Cannot declare class Onboarding, because the name is already in use in /home/user/invoice.mydomain.nl/database/migrations/2021_11_08_131308_onboarding.php on line 7
/public/ error_log:
No changes since last time.
cPanel invoice.mydomain.nl log:
No changes since last time.
cPanel SSL log:
35.223.227.96 - - [10/Mar/2022:08:03:50 +0100] “GET / HTTP/1.1” 200 1661 “-” “python-requests/2.27.1”
31.161.206.85 - - [10/Mar/2022:10:03:06 +0100] “GET /images/emails/forum.png HTTP/2.0” 200 1191 “-” “Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148”
31.161.206.85 - - [10/Mar/2022:10:03:06 +0100] “GET /images/emails/slack.png HTTP/2.0” 200 3215 “-” “Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148”
31.161.206.85 - - [10/Mar/2022:10:03:06 +0100] “GET /images/emails/email.png HTTP/2.0” 200 2298 “-” “Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148”
31.161.206.85 - - [10/Mar/2022:10:03:06 +0100] “GET /public/storage/hm0O9gmZJdMtRpNOvhEbtD0s2TCBV8mx/gvGszeyvmnrvFoGAy1GFnkEe5HR0M1tvguXAxhMV.png HTTP/2.0” 200 12955 “-” “Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148”
I’m in a similar situation.
I have deployed Invoice Ninja in a Synology using Web Station, but after the Apache or PHP update the PDF generation using Phantom has stopped working (registered using token).
I do not know how to solve it but I have to generate budgets and invoices.
Thank you @david for the quick update. Unfortunately it didn’t solve my problem just yet.
I updated through the UI of InvoiceNinja and after that ran: ‘php artisan optimize’
Both in various browsers and in the MacOSX app (Version 5.0.77 (77)) this problem persists.