Apache Error 500 at '/login' #502

Closed
opened 2026-02-04 20:37:01 +03:00 by OVERLORD · 24 comments
Owner

Originally created by @0Styless on GitHub (Nov 19, 2017).

For Bug Reports

  • BookStack Version: 0.18.5
  • PHP Version: 7.0.22-0ubuntu0.16.04.1
  • MySQL Version: 14.14 Distrib 5.7.20
Expected Behavior

Login in BookStackApp

Current Behavior

No login possible

Steps to Reproduce

Just try to open the BookStackApp.
Already established connections (logged in users) can continue to work. A new log in is not possible.

Output of storage/logs/laravel.log:
[2017-11-19 20:34:19] production.ERROR: SocialiteProviders\Manager\Exception\MissingConfigException: Configuration for AZURE_KEY is missing.

Configuration of .env:

# Environment
APP_ENV=production
APP_DEBUG=true
APP_KEY=xxxxxx

# The below url has to be set if using social auth options
# or if you are not using BookStack at the root path of your domain.
# APP_URL=http://bookstack.dev

# Database details
DB_HOST=localhost
DB_DATABASE=xxxxx
DB_USERNAME=xxxxx
DB_PASSWORD=xxxxx

# Cache and session
CACHE_DRIVER=database
SESSION_DRIVER=database
# If using Memcached, comment the above and uncomment these
#CACHE_DRIVER=memcached
#SESSION_DRIVER=memcached
QUEUE_DRIVER=sync

# Memcached settings
# If using a UNIX socket path for the host, set the port to 0
# This follows the following format: HOST:PORT:WEIGHT
# For multiple servers separate with a comma
MEMCACHED_SERVERS=127.0.0.1:11211:100

# Storage
STORAGE_TYPE=local
# Amazon S3 Config
STORAGE_S3_KEY=false
STORAGE_S3_SECRET=false
STORAGE_S3_REGION=false
STORAGE_S3_BUCKET=false
# Storage URL
# Used to prefix image urls for when using custom domains/cdns
STORAGE_URL=false

# General auth
AUTH_METHOD=standard

# Social Authentication information. Defaults as off.
GITHUB_APP_ID=false
GITHUB_APP_SECRET=false
GOOGLE_APP_ID=false
GOOGLE_APP_SECRET=false

# External services such as Gravatar
DISABLE_EXTERNAL_SERVICES=false

# LDAP Settings
LDAP_SERVER=false
LDAP_BASE_DN=false
LDAP_DN=false
LDAP_PASS=false
LDAP_USER_FILTER=false
LDAP_VERSION=false

# Mail settings
MAIL_DRIVER=smtp
MAIL_HOST=xxxxx
MAIL_PORT=xxx
MAIL_USERNAME=xxxx
MAIL_PASSWORD=xxxxx
MAIL_ENCRYPTION=tls
MAIL_FROM=xxxx

Originally created by @0Styless on GitHub (Nov 19, 2017). ### For Bug Reports * BookStack Version: 0.18.5 * PHP Version: 7.0.22-0ubuntu0.16.04.1 * MySQL Version: 14.14 Distrib 5.7.20 ##### Expected Behavior Login in BookStackApp ##### Current Behavior No login possible ##### Steps to Reproduce Just try to open the BookStackApp. Already established connections (logged in users) can continue to work. A new log in is not possible. Output of storage/logs/laravel.log: `[2017-11-19 20:34:19] production.ERROR: SocialiteProviders\Manager\Exception\MissingConfigException: Configuration for AZURE_KEY is missing.` Configuration of .env: ``` # Environment APP_ENV=production APP_DEBUG=true APP_KEY=xxxxxx # The below url has to be set if using social auth options # or if you are not using BookStack at the root path of your domain. # APP_URL=http://bookstack.dev # Database details DB_HOST=localhost DB_DATABASE=xxxxx DB_USERNAME=xxxxx DB_PASSWORD=xxxxx # Cache and session CACHE_DRIVER=database SESSION_DRIVER=database # If using Memcached, comment the above and uncomment these #CACHE_DRIVER=memcached #SESSION_DRIVER=memcached QUEUE_DRIVER=sync # Memcached settings # If using a UNIX socket path for the host, set the port to 0 # This follows the following format: HOST:PORT:WEIGHT # For multiple servers separate with a comma MEMCACHED_SERVERS=127.0.0.1:11211:100 # Storage STORAGE_TYPE=local # Amazon S3 Config STORAGE_S3_KEY=false STORAGE_S3_SECRET=false STORAGE_S3_REGION=false STORAGE_S3_BUCKET=false # Storage URL # Used to prefix image urls for when using custom domains/cdns STORAGE_URL=false # General auth AUTH_METHOD=standard # Social Authentication information. Defaults as off. GITHUB_APP_ID=false GITHUB_APP_SECRET=false GOOGLE_APP_ID=false GOOGLE_APP_SECRET=false # External services such as Gravatar DISABLE_EXTERNAL_SERVICES=false # LDAP Settings LDAP_SERVER=false LDAP_BASE_DN=false LDAP_DN=false LDAP_PASS=false LDAP_USER_FILTER=false LDAP_VERSION=false # Mail settings MAIL_DRIVER=smtp MAIL_HOST=xxxxx MAIL_PORT=xxx MAIL_USERNAME=xxxx MAIL_PASSWORD=xxxxx MAIL_ENCRYPTION=tls MAIL_FROM=xxxx ```
Author
Owner

@ssddanbrown commented on GitHub (Nov 20, 2017):

Hi @0Styless,

This is a strange issue. I'l likely need more information to be able to help at all.

What login methods are you using and/or trying to use?
After initial login, Are you trying to change or add any of the authentication options?
Have you made any changes to BookStack files other than the .env file?

@ssddanbrown commented on GitHub (Nov 20, 2017): Hi @0Styless, This is a strange issue. I'l likely need more information to be able to help at all. What login methods are you using and/or trying to use? After initial login, Are you trying to change or add any of the authentication options? Have you made any changes to BookStack files other than the `.env` file?
Author
Owner

@0Styless commented on GitHub (Nov 20, 2017):

Hey @ssddanbrown

Yes it is. The last thing I have changed is the update to version 0.18.5.
And the only change I did to he .env file is to turn on the debug mode after the issue occured. Also I have made no other changes to any files.

The authentication method that I use is standard. No social authentication. And I'm not trying to use anything else then that.

All users that are logged in can change and read/write data without any problems.
I have seen that the same error also occur when I try to click at a user in the administration settings.

@0Styless commented on GitHub (Nov 20, 2017): Hey @ssddanbrown Yes it is. The last thing I have changed is the update to version 0.18.5. And the only change I did to he .env file is to turn on the debug mode after the issue occured. Also I have made no other changes to any files. The authentication method that I use is standard. No social authentication. And I'm not trying to use anything else then that. All users that are logged in can change and read/write data without any problems. I have seen that the same error also occur when I try to click at a user in the administration settings.
Author
Owner

@0Styless commented on GitHub (Nov 22, 2017):

Hello @ssddanbrown

I have tried to reproduce the issue on a new server, unfortunately without any result.
I performed all settings that are also set on the production server and the application still works.

Any idea what I can try to solve the issue?

@0Styless commented on GitHub (Nov 22, 2017): Hello @ssddanbrown I have tried to reproduce the issue on a new server, unfortunately without any result. I performed all settings that are also set on the production server and the application still works. Any idea what I can try to solve the issue?
Author
Owner

@lommes commented on GitHub (Nov 23, 2017):

@0Styless did you update from a version of BookStack from before v0.18.2 (where azure was added)?

Can you check if config/services.php contains

'azure'   => [
        'client_id'     => env('AZURE_APP_ID', false),
        'client_secret' => env('AZURE_APP_SECRET', false),
        'tenant'       => env('AZURE_TENANT', false),
        'redirect'      => env('APP_URL') . '/login/service/azure/callback',
        'name'          => 'Microsoft Azure',
    ],

You also may try to set

AZURE_KEY=false
AZURE_SECRET=false
AZURE_REDIRECT_URI=false

in your .env file.

@lommes commented on GitHub (Nov 23, 2017): @0Styless did you update from a version of BookStack from before v0.18.2 (where azure was added)? Can you check if `config/services.php` contains ``` 'azure' => [ 'client_id' => env('AZURE_APP_ID', false), 'client_secret' => env('AZURE_APP_SECRET', false), 'tenant' => env('AZURE_TENANT', false), 'redirect' => env('APP_URL') . '/login/service/azure/callback', 'name' => 'Microsoft Azure', ], ``` You also may try to set ``` AZURE_KEY=false AZURE_SECRET=false AZURE_REDIRECT_URI=false ``` in your .env file.
Author
Owner

@0Styless commented on GitHub (Nov 23, 2017):

Hey @lommes

no nothing like that. I always used the standard authentication.
The config/services.php contains exactly these settings. Also I have set the options in the .env file, but nothing has changed.

Fortunately I have found a workaround. It seems to help to remove the application folder and install it new from the scratch (of course keep the database so there is no data loss). I know that is not the solution to this problem but it helps for the moment,

In fact I did the following:

cd /var/www/
mv BookStack BookStack_org
git clone https://github.com/BookStackApp/BookStack.git --branch release --single-branch
cd BookStack/
composer install
cp ../BookStack_org/.env .
mv ../BookStack_org/public/uploads/images/* public/uploads/images/
cd ..
chown -R www-data:www-data BookStack/
chmod -R o-rwx BookStack/
service apache2 restart
service mysql restart

For the moment the problem is gone. But I would glad to hear how to avoid this issue in the future.

@0Styless commented on GitHub (Nov 23, 2017): Hey @lommes no nothing like that. I always used the standard authentication. The `config/services.php` contains exactly these settings. Also I have set the options in the `.env` file, but nothing has changed. Fortunately I have found a workaround. It seems to help to remove the application folder and install it new from the scratch (of course keep the database so there is no data loss). I know that is not the solution to this problem but it helps for the moment, In fact I did the following: ``` cd /var/www/ mv BookStack BookStack_org git clone https://github.com/BookStackApp/BookStack.git --branch release --single-branch cd BookStack/ composer install cp ../BookStack_org/.env . mv ../BookStack_org/public/uploads/images/* public/uploads/images/ cd .. chown -R www-data:www-data BookStack/ chmod -R o-rwx BookStack/ service apache2 restart service mysql restart ``` For the moment the problem is gone. But I would glad to hear how to avoid this issue in the future.
Author
Owner

@ssddanbrown commented on GitHub (Nov 23, 2017):

@0Styless If I'm honest I have no idea about this. I can in no way find the string AZURE_KEY within any files used in BookStack at all.

If you still have your old, broken directory/install backed up it would be great if you could run:

grep -r "AZURE_KEY"

within the directory to see if you have that string defined anywhere.

@ssddanbrown commented on GitHub (Nov 23, 2017): @0Styless If I'm honest I have no idea about this. I can in no way find the string `AZURE_KEY` within any files used in BookStack at all. If you still have your old, broken directory/install backed up it would be great if you could run: ```shell grep -r "AZURE_KEY" ``` within the directory to see if you have that string defined anywhere.
Author
Owner

@lommes commented on GitHub (Nov 23, 2017):

@ssddanbrown thats why i thought it might be a problem with the update to 0.18.2+ because there are the values set to false. AZURE_KEY seems to be in the code of the Azure provider.

@lommes commented on GitHub (Nov 23, 2017): @ssddanbrown thats why i thought it might be a problem with the update to 0.18.2+ because there are the values set to false. AZURE_KEY seems to be in the code of the Azure provider.
Author
Owner

@0Styless commented on GitHub (Nov 24, 2017):

Hey @ssddanbrown the only file where the string is defined is in the .env file.
Of course only because @lommes told me to try these options.

And there are a few lines in the storage/logs/laravel.log, probably from the debug mode.

@0Styless commented on GitHub (Nov 24, 2017): Hey @ssddanbrown the only file where the string is defined is in the `.env` file. Of course only because @lommes told me to try these options. And there are a few lines in the `storage/logs/laravel.log`, probably from the debug mode.
Author
Owner

@schmidfelix commented on GitHub (Nov 29, 2017):

I have the same problem.

@schmidfelix commented on GitHub (Nov 29, 2017): I have the same problem.
Author
Owner

@0Styless commented on GitHub (Nov 29, 2017):

Hey @Schmiddinger

did you tried the workaround too? Does it work in your environment?

@0Styless commented on GitHub (Nov 29, 2017): Hey @Schmiddinger did you tried the workaround too? Does it work in your environment?
Author
Owner

@schmidfelix commented on GitHub (Nov 29, 2017):

Yes I tried it and no, I't doesn't work :D

@schmidfelix commented on GitHub (Nov 29, 2017): Yes I tried it and no, I't doesn't work :D
Author
Owner

@lommes commented on GitHub (Nov 30, 2017):

@0Styless do you remember what your exact version before the update to 0.18.5 was?

@Schmiddinger Did it happen after an update too or in a fresh install?

@lommes commented on GitHub (Nov 30, 2017): @0Styless do you remember what your exact version before the update to 0.18.5 was? @Schmiddinger Did it happen after an update too or in a fresh install?
Author
Owner

@schmidfelix commented on GitHub (Nov 30, 2017):

@lommes It happend after a fresh install. I've installed all components via composer, etc.

@schmidfelix commented on GitHub (Nov 30, 2017): @lommes It happend after a fresh install. I've installed all components via composer, etc.
Author
Owner

@0Styless commented on GitHub (Nov 30, 2017):

Hey @lommes

must be the beta release 0.18.0.

@0Styless commented on GitHub (Nov 30, 2017): Hey @lommes must be the beta release 0.18.0.
Author
Owner

@ssddanbrown commented on GitHub (Dec 4, 2017):

Okay, Think I've found where this error stems from:
https://github.com/SocialiteProviders/Manager/blob/v3.2.0/src/Helpers/ConfigRetriever.php#L156

Might be throwing us off by the way different errors are collected and reported on later within the way SocialiteProviders/Manager handles errors.

This could possibly be an issue due to config caching. If the config is cached without the azure config then this error could be thrown.

Check if you have a bootstrap/cache/config.php file and, if so, delete it. Let me know if that fixes things.

@ssddanbrown commented on GitHub (Dec 4, 2017): Okay, Think I've found where this error stems from: https://github.com/SocialiteProviders/Manager/blob/v3.2.0/src/Helpers/ConfigRetriever.php#L156 Might be throwing us off by the way different errors are collected and reported on later within the way SocialiteProviders/Manager handles errors. This could possibly be an issue due to config caching. If the config is cached without the azure config then this error could be thrown. Check if you have a `bootstrap/cache/config.php` file and, if so, delete it. Let me know if that fixes things.
Author
Owner

@schmidfelix commented on GitHub (Dec 4, 2017):

This file doesn't exists ;D

@schmidfelix commented on GitHub (Dec 4, 2017): This file doesn't exists ;D
Author
Owner

@0Styless commented on GitHub (Dec 4, 2017):

@Schmiddinger @ssddanbrown

In my "corrupted" installation the file exists, should I give it a try when I have the time?

@0Styless commented on GitHub (Dec 4, 2017): @Schmiddinger @ssddanbrown In my "corrupted" installation the file exists, should I give it a try when I have the time?
Author
Owner

@schmidfelix commented on GitHub (Dec 10, 2017):

@ssddanbrown

@schmidfelix commented on GitHub (Dec 10, 2017): @ssddanbrown
Author
Owner

@schmidfelix commented on GitHub (Dec 20, 2017):

?

@schmidfelix commented on GitHub (Dec 20, 2017): ?
Author
Owner

@ssddanbrown commented on GitHub (Dec 20, 2017):

@Schmiddinger I'd suggest trying to update to v0.19 following the update guide steps to see if the problem remains. I'm hoping a good change and update of dependencies may solve this.

@ssddanbrown commented on GitHub (Dec 20, 2017): @Schmiddinger I'd suggest trying to update to v0.19 following the [update guide steps](https://www.bookstackapp.com/docs/admin/updates/) to see if the problem remains. I'm hoping a good change and update of dependencies may solve this.
Author
Owner

@schmidfelix commented on GitHub (Jan 3, 2018):

the error keeps alive

@schmidfelix commented on GitHub (Jan 3, 2018): the error keeps alive
Author
Owner

@alariva commented on GitHub (Jan 13, 2018):

Deleting as per https://github.com/BookStackApp/BookStack/issues/596#issuecomment-349062490 worked for me. v0.18.5

@alariva commented on GitHub (Jan 13, 2018): Deleting as per https://github.com/BookStackApp/BookStack/issues/596#issuecomment-349062490 worked for me. `v0.18.5`
Author
Owner

@ltoop commented on GitHub (Jun 18, 2018):

Found myself here when trying to resolve the same error.
In my case: when I had run composer install it had not exited cleanly - hadn't copied .env.example yet and my hosting provider had an older version of PHP as default. After updating the .env file and setting the path to use a later version of php, running composer install completed successfully and resolved the 500 error

@ltoop commented on GitHub (Jun 18, 2018): Found myself here when trying to resolve the same error. In my case: when I had run `composer install` it had not exited cleanly - hadn't copied .env.example yet and my hosting provider had an older version of PHP as default. After updating the .env file and setting the path to use a later version of php, running `composer install` completed successfully and resolved the 500 error
Author
Owner

@ssddanbrown commented on GitHub (May 7, 2019):

Since the last comment on this issue is relatively old I'm going to close this. If the issue remains and is something you still require to be fixed please open a new issue, referencing this one.

@ssddanbrown commented on GitHub (May 7, 2019): Since the last comment on this issue is relatively old I'm going to close this. If the issue remains and is something you still require to be fixed please open a new issue, referencing this one.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#502