cydrobolt / polr

:aerial_tramway: A modern, powerful, and robust URL shortener
https://polrproject.org
GNU General Public License v2.0
4.99k stars 894 forks source link

"No supported encrypter found. The cipher and / or key length are invalid." #530

Closed rdm closed 5 years ago

rdm commented 5 years ago

Expected Behavior

Polr should function, instead of giving me error messages.

Current Behavior

When I visit my /setup on a new polr installation, I get the message (twice): "Whoops, looks like something went wrong."

This message comes from vendor/symfony/debug/ExceptionHandler.php

If I further edit that file, adding a first line of the function getContent which reads: $this->debug= 1;

visiting setup gives me a stack trace which looks like this:

RuntimeException in EncryptionServiceProvider.php line 29: No supported encrypter found. The cipher and / or key length are invalid. in EncryptionServiceProvider.php line 29 at EncryptionServiceProvider->Illuminate\Encryption{closure}(object(Application), array()) in Container.php line 738 at Container->build(object(Closure), array()) in Container.php line 631 at Container->make('encrypter', array()) in Application.php line 447 at Application->make('encrypter') in Application.php line 822 at Application->loadComponent('app', 'Illuminate\Encryption\EncryptionServiceProvider', 'encrypter') in Application.php line 577 at Application->Laravel\Lumen{closure}(object(Application), array()) in Container.php line 738 at Container->build(object(Closure), array()) in Container.php line 631 at Container->make('encrypter', array()) in Application.php line 447 at Application->make('Illuminate\Contracts\Encryption\Encrypter') in Container.php line 842 at Container->resolveClass(object(ReflectionParameter)) in Container.php line 805 at Container->getDependencies(array(object(ReflectionParameter)), array()) in Container.php line 775 at Container->build('Illuminate\Cookie\Middleware\EncryptCookies', array()) in Container.php line 631 at Container->make('Illuminate\Cookie\Middleware\EncryptCookies', array()) in Application.php line 447 at Application->make('Illuminate\Cookie\Middleware\EncryptCookies') in Pipeline.php line 123 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102 at Pipeline->then(object(Closure)) in Application.php line 1439 at Application->sendThroughPipeline(array('Illuminate\Cookie\Middleware\EncryptCookies', 'Illuminate\Session\Middleware\StartSession', 'Illuminate\View\Middleware\ShareErrorsFromSession', 'App\Http\Middleware\VerifyCsrfToken'), object(Closure)) in Application.php line 1213 at Application->dispatch(null) in Application.php line 1153 at Application->run() in index.php line 28

(There's another, shorter stack trace, which then happens on line 1162 in this Application.php, but it's the same error message.)

But there's no mention of cipher in any non-vendor code.

There's also five different Application.php instances in this system -- mousing over the file name suggests that this specific instance is vendor/laravel/lumen-framework/src/Application.php

Your Environment

Ubuntu 18.4 apt update apt upgrade apt install mysql-server mysql-client php php-mysql php7.2-mbstring php7.2-curl php-xml mmdb-bin zip unzip

then the instructions at https://docs.polrproject.org/en/latest/user-guide/installation/

I've followed the "Option 2" method involving copying resources/views/env.blade.php to .env and editing it, except that I don't know what to insert into the users table to generate an admin user so I have not completed that step.

(If I need to reset my environment and try Option 1, it would be good to have some details on what all needs to be reverted before trying Option 1 again. For example, would I need to delete the database tables?)

rdm commented 5 years ago

P.S.

php artisan key:generate

from the command line in /var/www/polr/ gives me:

[InvalidArgumentException]
There are no commands defined in the "key" namespace.

rdm commented 5 years ago

And... the problem was that my APP_KEY in .env was 31 characters long instead of 32...