cachethq / Docker

A Dockerized version of Cachet.
https://cachethq.io
BSD 3-Clause "New" or "Revised" License
411 stars 285 forks source link

RuntimeException: No supported encrypter found. The cipher and / or key length are invalid. #381

Open DevMan01 opened 4 years ago

DevMan01 commented 4 years ago

No matter what I do, I can't seem to get the guy to boot up with an APP_KEY that it'll take with consistency.

docker-compose.yaml reads this, under the environment: - APP_KEY=odsoIqIptj9ADwVS9onivtmarnFKQhG3

This is what spits out in the run time logs:

Backup skipped!
Backup completed!
Application key [base64:vGSwhwLZjWiucsWF6jEyF6Mk/jgfNU0uAdK2Q1sTR4w=] set successfully.
Configuration cache cleared!
Configuration cached successfully!
Route cache cleared!

When I go into the deployment, and look at the .env file this is what I see set: APP_KEY="base64:oRx0GVFwZRvofbeo1Et/EoSCh+Fel+GQF3yUyGGbGYg="

No wonder when the app tries to start up it gives me this error:

[2020-06-26 02:14:47] production.ERROR: RuntimeException: No supported encrypter found. The cipher and / or key length are invalid. in /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php:45

It's probably unable to find consistency in the values. cachet v2.3.18

truppert-mdsol commented 3 years ago

Hi @DevMan01 I had the same problem for a bit. The issue for me was that I used an incorrect APP_KEY, which looks like it may be your issue as well. From your logs, it looks like you need to set your APP_KEY to the string base64:vGSwhwLZjWiucsWF6jEyF6Mk/jgfNU0uAdK2Q1sTR4w=

rohit-gohri commented 3 years ago

API_KEY needs to be 32 chars: https://github.com/CachetHQ/Docker/issues/330#issuecomment-490574998 This fixed it for me

Lemmmy commented 3 years ago

Just noticed that the README of this repo tells you to use artisan to generate the key (which has the correct format and length), but the actual guide doesn't explain it yet:

docker exec -i ID_OF_THE_CONTAINER php artisan key:generate

For anyone finding this issue, just use that command to generate the key.