snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11.03k stars 3.18k forks source link

Changing language gives server error 500 #14444

Closed LizardWizardGB closed 7 months ago

LizardWizardGB commented 7 months ago

Debug mode

Describe the bug

Whenever I change the language, I get "Server Error 500", when trying to access Snipe-IT.

If a user changes their language, they are "locked out" of Snipe-IT, because all they get when logging in, is "server error 500". This happened with my only user, so I had to change the language on my user, directly in the database.

Reproduction steps

  1. Change the language from en-US to any other language.
  2. results in server error 500.

Expected behavior

Language should change for the user.

Screenshots

No response

Snipe-IT Version

v6.3.3 - build 12903 (master)

Operating System

Ubuntu 22.04

Web Server

Apache

PHP Version

8.1.2-1ubuntu2.14

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

Apache access.log and error.log doesn't show anything and neither does laravel.log...

UnexpectedValueException
The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: UnexpectedValueException: The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: Your current APP_LOCALE in your .env is set to "en-US" and should be updated to be "en-GB" in /var/www/html/snipeit/.env. Translations may display unexpectedly until this is updated. in /var/www/html/snipeit/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:146 Stack trace: #0 /var/www/html/snipeit/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(48): Monolog\Handler\StreamHandler->write() #1 /var/www/html/snipeit/vendor/monolog/monolog/src/Monolog/Logger.php(359): Monolog\Handler\AbstractProcessingHandler->handle() #2 /var/www/html/snipeit/vendor/monolog/monolog/src/Monolog/Logger.php(589): Monolog\Logger->addRecord() #3 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Log/Logger.php(183): Monolog\Logger->warning() #4 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Log/Logger.php(106): Illuminate\Log\Logger->writeLog() #5 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(605): Illuminate\Log\Logger->warning() #6 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\Log\LogManager->warning() #7 /var/www/html/snipeit/app/Http/Middleware/CheckLocale.php(40): Illuminate\Support\Facades\Facade::__callStatic() #8 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\CheckLocale->handle() #9 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #10 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle() #11 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #12 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle() #13 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() #14

Additional context

This is a fresh install, done with install.sh. The installation is using Cloudflare Tunnel.

Everything else in Snipe-IT is working, except for Purge (/admin/purge), which also gives a server error 500, regardless of language.

I've also tried changing the language to something else, on my user, directly in the database: UPDATE users SET locale = 'da-DK' WHERE id = 1; This didn't work either.

I've tried installing da_DK locale on the server itself.

welcome[bot] commented 7 months ago

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

snipe commented 7 months ago

The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied

Your laravel log is not writable by the web server. Fix the permissions and you should be fine. https://snipe-it.readme.io/docs/debugging-permissions

Snipe-IT Documentation
Debugging Server Permissions
❗️This article refers to web server file system permissions onlyIt does not address Snipe-IT application permissions.One of the most common issues folks newer to running web servers run into is how to manage the Linux/Windows/etc owners and groups of the Snipe-IT filesystem.As we mention many times ...
LizardWizardGB commented 7 months ago

Thank you, @snipe. Fixing the permissions, solved the issue.