"500 | Server Error" while trying renew the licence V4

Hi,

We are using invoice ninja V4 for over 2 years, and last week we got warning licence should be renewed. We purchased a new licence but when we try to apply it we get “500 | Server Error.”

We have contacted “[email protected]” but they stop responding after couple of e-mails.

This is our 3rd time of renewing licence and we never had similar issue before, and we didn’t make any change on the system since.

When checking there is following nginx error log;

2025/03/19 05:10:15 [crit] 1840146#1840146: *5254 SSL_do_handshake() failed (SSL: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share) while SSL handshaking, client: 192.168.12.1, server: 0.0.0.0:443

Also the there is following Laravel-error log;

[2025-03-14T08:37:54.867328+00:00] production.ERROR: [stacktrace] 2025-03-14 08:37:54 Header may not contain more than a single header, new line detected: #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() #1 /var/www/our_domain/vendor/symfony/http-foundation/Response.php(346): header() #2 /var/www/our_domain/vendor/symfony/http-foundation/Response.php(380): Symfony\Component\HttpFoundation\Response->sendHeaders() #3 /var/www/our_domain/public/index.php(56): Symfony\Component\HttpFoundation\Response->send() #4 {main} {“context”:“PHP”,“user_id”:1,“account_id”:1,“user_name”:“our_name”,“method”:“GET”,“user_agent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36”,“locale”:“en”,“ip”:“192.168.12.1”,“count”:2,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”,“url”:“white_label/purchase”}
[2025-03-14T08:38:19.018266+00:00] production.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError [0] : /var/www/our_domain/app/Http/Middleware/StartupCheck.php [Line 190] => Call to a member function modify() on bool {“context”:“PHP”,“user_id”:1,“account_id”:1,“user_name”:“our_name”,“method”:“GET”,“user_agent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36”,“locale”:“en”,“ip”:“192.168.12.1”,“count”:1,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”,“url”:“dashboard”}
[2025-03-14T08:38:19.018816+00:00] production.ERROR: [stacktrace] 2025-03-14 08:38:19 Call to a member function modify() on bool: #0 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\StartupCheck->handle() #1 /var/www/our_domain/app/Http/Middleware/QueryLogging.php(32): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() #2 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\QueryLogging->handle() #3 /var/www/our_domain/app/Http/Middleware/DuplicateSubmissionCheck.php(41): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() #4 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\DuplicateSubmissionCheck->handle() #5 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() #6 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle() #7 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() #8 /var/www/our_domain/app/Http/Middleware/VerifyCsrfToken.php(44): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle() #9 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): App\Http\Middleware\VerifyCsrfToken->handle() #10 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() #11 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\View\Middleware\ShareErrorsFromSession->handle() #12 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(56): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() #13 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Session\Middleware\StartSession->handle() #14 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() #15 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle() #16 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() #17 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Cookie\Middleware\EncryptCookies->handle() #18 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() #19 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Routing/Router.php(683): Illuminate\Pipeline\Pipeline->then() #20 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Routing/Router.php(658): Illuminate\Routing\Router->runRouteWithinStack() #21 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Routing/Router.php(624): Illuminate\Routing\Router->runRoute() #22 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Routing/Router.php(613): Illuminate\Routing\Router->dispatchToRoute() #23 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(170): Illuminate\Routing\Router->dispatch() #24 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}() #25 /var/www/our_domain/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(60): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() #26 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Barryvdh\Debugbar\Middleware\InjectDebugbar->handle() #27 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(63): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() #28 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle() #29 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() #30 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\Pipeline\Pipeline->then() #31 /var/www/our_domain/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter() #32 /var/www/our_domain/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle() #33 {main} {“context”:“PHP”,“user_id”:1,“account_id”:1,“user_name”:“our_name”,“method”:“GET”,“user_agent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36”,“locale”:“en”,“ip”:“192.168.12.1”,“count”:2,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”,“url”:“dashboard”}

Hi,

Have you made any changes to the codebase? You may want to try setting up a clean install, copy over the a copy of the DB and .env file and then try applying it.

In the past I’ve seen this error (Header may not contain more than a single header, new line detected: #0 [internal function]:slight_smile: if I accidentally added a blank line to a code file.

Hi @hillel ,

Thanks for your reply. We had someone install this three years ago, and since then, we’ve only been using the UI, and never accessed the code.

We’d prefer to resolve the existing issue rather than performing a clean install, as we don’t want to risk losing any existing data.

Is there any additional information or log file I can share to help identify the problem?

Best regards,

I’m not sure, here’s what ChatGPT suggests:

The error message suggests that a header is being set with an unintended newline, which is causing an issue in Invoice Ninja. Here are a few potential causes and fixes:

1. Check Your Environment Variables (.env file)

  • Sometimes, misconfigured .env variables (like APP_NAME, MAIL_FROM_NAME, or MAIL_FROM_ADDRESS) may include newlines or invalid characters.
  • Run:
    php artisan config:clear
    
    to refresh the configuration.

2. Look for Headers Being Set Improperly

  • This issue could arise if a custom header contains an unexpected newline. If you’ve made modifications to middleware, API responses, or email headers, check for unintended line breaks.

3. Check Email Configuration (MAIL_* Settings)

  • If this error occurs during an email operation (invoice sending, notifications, etc.), inspect MAIL_FROM_NAME and MAIL_FROM_ADDRESS in your .env file.
  • Ensure they do not contain newline characters (\n or \r\n).
  • Example:
    MAIL_FROM_NAME="Invoice Ninja"
    MAIL_FROM_ADDRESS="[email protected]"
    
  • If these values were entered through the UI, check the settings in Settings → Email Settings.

4. Inspect Middleware or Response Modifications

  • If you’ve added custom middleware or response modifications, ensure that headers are set correctly without unintended newlines.

5. Debug Further

  • Enable debug mode by setting APP_DEBUG=true in .env, then reload the application and check storage/logs/laravel.log for a full stack trace.
  • If the error happens during an API request, try checking the raw response headers using:
    curl -v https://yourdomain.com/api
    

If the issue persists, share more of the stack trace, and I can help troubleshoot further! :rocket: