After upgrade to v5.5.15, 500 error preventing login

Hello,
I can no longer login due to receiving a 500: Server Error when trying to login.

Here’s what I have tried to fix this:

  • downloaded latest release from github and unzipped it into the application directory
  • cleared out files in /bootstrap/cache/
  • ran php artisan optimize
  • ran php artisan flush:cache

This error is showing in the server error_log in the /public/ directory:

PHP Fatal error:  Declaration of Symfony\Component\HttpFoundation\Response
HeaderBag::set(string $key, array|string|null $values, bool $replace = true) must
 be compatible with Symfony\Component\HttpFoundation\HeaderBag::set(string
 $key, $values, bool $replace = true) in /home/myusername/public_html/billing/v
endor/symfony/http-foundation/ResponseHeaderBag.php on line 109

Other information

  • Shared server
  • running out of a subfolder (had to make this fix in order to get it running)
  • PHP 8.1.4
  • Have 2FA setup
  • Nothing in /storage/logs/

Hi,

Thanks for sharing what you’ve tried, @david any thoughts?

Also, I’ve tried putting in a known bad password, and I get “401: These credentials do not match our records” as expected. So it seems like I’m able to authenticate fine. But when I give the correct user/pass/2fa, that’s when I get stopped by the 500 error (loads inside the login box).

The 500 comes from an POST request to https://application.ur/my/path/public/index.php/api/v1/login?first_load=true&include_static=true

I also see this error log:

[Tue Aug 23 14:14:39.971705 2022] [lsapi:error] [pid 3336884:tid 47791440496384] [client 72.73.94.57:59888] [host myapplication.url] Backend fatal error: PHP Fatal error: Uncaught Error: Class “Illuminate\Http\JsonResponse” not found in /home/myusername/public_html/billing/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:686\nStack trace:\n#0 /home/myusername/public_html/billing/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(446): Illuminate\Foundation\Exceptions\Handler->prepareJsonResponse()\n#1 /home/myusername/public_html/billing/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(366): Illuminate\Foundation\Exceptions\Handler->renderExceptionResponse()\n#2 /home/myusername/public_html/billing/app/Exceptions/Handler.php(209): Illuminate\Foundation\Exceptions\Handler->render()\n#3 /home/myusername/public_html/billing/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(196): App\Exceptions\Handler->render()\n#4 /home/myusername/public_html/billing/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(173): Illuminate\Foundation\Bootstrap\HandleExceptions->renderHttpResponse()\n#5 /home/myusername/public_html/billing/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(209): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException()\n#6 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()\n#7 {main}\n thrown in /home/myusername/public_html/billing/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php on line 686\n, referer: https://myapplication.ur/my/path/public/index.php

can you try running

composer i -o --no-dev

Thanks @david I meant to note that I had tried that too. Since I used the github release in a zip file, I wouldn’t think that running composer would be needed here.

In any case, when I run that I get the following:

Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.

  Problem 1
    - lcobucci/jwt is locked to version 4.1.5 and an update of this package was not requested.
    - lcobucci/jwt 4.1.5 requires ext-sodium * -> it is missing from your system. Install or enable PHP's sodium extension.
  Problem 2
    - lcobucci/jwt 4.1.5 requires ext-sodium * -> it is missing from your system. Install or enable PHP's sodium extension.
    - socialiteproviders/apple 5.3.0 requires lcobucci/jwt ^4.1.5 -> satisfiable by lcobucci/jwt[4.1.5].
    - socialiteproviders/apple is locked to version 5.3.0 and an update of this package was not requested.

To enable extensions, verify that they are enabled in your .ini files:
    - /opt/alt/php81/etc/php.ini
    - /opt/alt/php81/link/conf/alt_php.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-sodium --ignore-platform-req=ext-sodium` to temporarily ignore these required extensions.

I’ve also double checked that I have all the required extensions/modules on my server.

And if I run composer update I get:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - lcobucci/jwt[4.1.5, ..., 4.3.x-dev] require ext-sodium * -> it is missing from your system. Install or enable PHP's sodium extension.
    - socialiteproviders/apple[5.2.0, ..., 5.3.0] require lcobucci/jwt ^4.1.5 -> satisfiable by lcobucci/jwt[4.1.5, ..., 4.3.x-dev].
    - Root composer.json requires socialiteproviders/apple ^5.2 -> satisfiable by socialiteproviders/apple[5.2.0, 5.3.0].

To enable extensions, verify that they are enabled in your .ini files:
    - /opt/alt/php81/etc/php.ini
    - /opt/alt/php81/link/conf/alt_php.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-sodium` to temporarily ignore these required extensions.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

So I’ve installed the Sodium php extension, and that allowed me to run composer update, then I ran composer i -o --no-dev again just for the heck of it. Ran php artisan optimize and rm bootstrap/cache/*.php. Still a 500 error.

Interesting:

If I switch the database to a new install, it works great without the 500 error. When I switch back to the real database, I get the login error. There’s maybe something in the database causing this problem, but I wouldn’t have any idea where to troubleshoot.

I turned on APP_DEBUG="true" and now the 500 message upon attempting to login is 500: No Company Found.

Any ideas on how to fix this? Sounds like my db might be borked.

@jake

Is this a new installation? usually when you see no company found it means that the there are no companies linked under your account.

That happened to me couple of time I upgraded to newer version.

Try

php artisan migrate

Thanks @johnw and @david – I gave up before I got these message. Since I’d only been using InvoiceNinja for a week, I just tried to manually migrate what db tables I could, and called it part of the learning process of a new application.

I had not tried php artisan migrate, and would have liked to try that, but I’m essentially now operating on a brand new installation.