Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Application Encryption Key Error #711

Closed
akalderon opened this issue Aug 31, 2023 · 15 comments
Closed

No Application Encryption Key Error #711

akalderon opened this issue Aug 31, 2023 · 15 comments

Comments

@akalderon
Copy link

akalderon commented Aug 31, 2023

Describe the bug
After deploying the latest version via Docker & MariaDB I am getting the following error which leads to a Server Error 500:

"No application encryption key has been specified"

To Reproduce
Steps to reproduce the behavior:

  1. Deployed the latest version (v.0.11.20) via a docker-compose file - same settings as the prior version - no other changes other than shutting down the container, pulling the new image and starting it back up
  2. reverting to 0.11.17 brings it back up so it is definitely associated with the most recent releases
  3. Could be same root cause as the other reported bug relating to SQLite errors?
  4. docker stop container speed-tracker
  5. docker pull the latest image
  6. docker compose up -d
  7. full error log below

Expected behavior
Should have been upgraded in-place. Reverting to v.0.11.19 does not bring it back up - same error as above - this version worked fine until 10 minutes ago

Environment (please complete the following information):

  • Debian 12
  • Architecture: amd64
  • Browser chrome & safari
  • Version v.0.11.20 & 0.11.19 while trying to downgrade

Screenshots
If applicable, add screenshots to help explain your problem.

Logs

docker-compose.yml:

version: '3.3'
services:
speedtest-tracker:
container_name: speedtest-tracker
ports:
- '8280:80'
- '8281:443'
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
- TELEGRAM_BOT_TOKEN=***********************************
- DB_CONNECTION=mysql
- DB_HOST=mariadb
- DB_PORT=3306
- DB_DATABASE=speedtest_tracker
- DB_USERNAME=root
- DB_PASSWORD=********

    volumes:
        - '/etc/localtime:/etc/localtime:ro'
        - '*******/config:/config'
        - '*******/web:/etc/ssl/web'
    image: 'ghcr.io/alexjustesen/speedtest-tracker:latest'
    restart: unless-stopped

###Log file:

`--------------------------------------------------------------------


| |.-----.-----.-----.--| | |.-----.-----.| |
|
|| _ | -| -| _ | | -| --|| |
|
|| |||___|||||___|
|__|


|_ |.----.---.-.----.| |--.-----.----.
| | | | _ | || <| -| |
|
| || |.|____||||___||


To support Speedtest Tracker visit:
https://github.com/alexjustesen/speedtest-tracker

GID/UID

User uid: 1000
User gid: 1000

🔒 SSL_MODE has been set to MIXED, setting the web server to work in HTTP + HTTPS...

🐇 Configuring Speedtest Tracker...

🔒 Fixing app path file permissions...
✅ Permissions fixed.

✅ Environment file exists.

🔗 Creating symlinks for config and log files...
✅ Symlinks created.

✅ App key exists

🔐 Linking the storage...
✅ Storage linked.

💰 Building the cache...
✅ Cache set.

🚛 Migrating the database...
✅ Database migrated.

✅ All set, Speedtest Tracker started.

[31-Aug-2023 09:57:59] NOTICE: fpm is running, pid 126
[31-Aug-2023 09:57:59] NOTICE: ready to handle connections
[31-Aug-2023 09:57:59] NOTICE: systemd monitor interval set to 10000ms
172.26.0.6 - - [31/Aug/2023:09:58:12 -0400] "GET /api/speedtest/latest HTTP/1.1" 200 284 "-" "-"
[2023-08-31 13:58:15] production.ERROR: No application encryption key has been specified. {"exception":"[object] (Illuminate\Encryption\MissingAppKeyException(code: 0): No application encryption key has been specified. at /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php:79)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/helpers.php(307): Illuminate\Encryption\EncryptionServiceProvider->Illuminate\Encryption\{closure}()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(81): tap()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(60): Illuminate\Encryption\EncryptionServiceProvider->key()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(32): Illuminate\Encryption\EncryptionServiceProvider->parseKey()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(908): Illuminate\Encryption\EncryptionServiceProvider->Illuminate\Encryption\{closure}()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\Container\Container->build()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(937): Illuminate\Container\Container->resolve()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\Foundation\Application->resolve()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(922): Illuminate\Container\Container->make()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(1066): Illuminate\Foundation\Application->make()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(982): Illuminate\Container\Container->resolveClass()
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(943): Illuminate\Container\Container->resolveDependencies()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\Container\Container->build()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(937): Illuminate\Container\Container->resolve()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\Foundation\Application->resolve()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(922): Illuminate\Container\Container->make()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(169): Illuminate\Foundation\Application->make()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(800): Illuminate\Pipeline\Pipeline->then()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(777): Illuminate\Routing\Router->runRouteWithinStack()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(741): Illuminate\Routing\Router->runRoute()
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(730): Illuminate\Routing\Router->dispatchToRoute()
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\Routing\Router->dispatch()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()
#24 /var/www/html/vendor/livewire/livewire/src/DisableBrowserCache.php(19): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Livewire\DisableBrowserCache->handle()
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#27 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#28 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle()
#29 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#31 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\TrimStrings->handle()
#32 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#33 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle()
#34 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(89): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#35 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle()
#36 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#37 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Http\Middleware\HandleCors->handle()
#38 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#39 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Http\Middleware\TrustProxies->handle()
#40 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#41 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\Pipeline\Pipeline->then()
#42 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()
#43 /var/www/html/public/index.php(52): Illuminate\Foundation\Http\Kernel->handle()
#44 {main}
"}
172.26.0.6 - - [31/Aug/2023:09:58:16 -0400] "GET / HTTP/1.1" 500 6628 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
[2023-08-31 13:58:16] production.ERROR: No application encryption key has been specified. {"exception":"[object] (Illuminate\Encryption\MissingAppKeyException(code: 0): No application encryption key has been specified. at /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php:79)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/helpers.php(307): Illuminate\Encryption\EncryptionServiceProvider->Illuminate\Encryption\{closure}()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(81): tap()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(60): Illuminate\Encryption\EncryptionServiceProvider->key()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(32): Illuminate\Encryption\EncryptionServiceProvider->parseKey()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(908): Illuminate\Encryption\EncryptionServiceProvider->Illuminate\Encryption\{closure}()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\Container\Container->build()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(937): Illuminate\Container\Container->resolve()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\Foundation\Application->resolve()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(922): Illuminate\Container\Container->make()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(1066): Illuminate\Foundation\Application->make()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(982): Illuminate\Container\Container->resolveClass()
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(943): Illuminate\Container\Container->resolveDependencies()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\Container\Container->build()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(937): Illuminate\Container\Container->resolve()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\Foundation\Application->resolve()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(922): Illuminate\Container\Container->make()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(255): Illuminate\Foundation\Application->make()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(213): Illuminate\Foundation\Http\Kernel->terminateMiddleware()
#18 /var/www/html/public/index.php(55): Illuminate\Foundation\Http\Kernel->terminate()
#19 {main}
"}
172.26.0.6 - - [31/Aug/2023:09:58:16 -0400] "GET /api/speedtest/latest HTTP/1.1" 200 284 "-" "-"
172.26.0.6 - - [31/Aug/2023:09:59:00 -0400] "GET /api/speedtest/latest HTTP/1.1" 200 284 "-" "-"
172.26.0.6 - - [31/Aug/2023:09:59:01 -0400] "GET /api/speedtest/latest HTTP/1.1" 200 284 "-" "-"
172.26.0.6 - - [31/Aug/2023:09:59:03 -0400] "GET /api/speedtest/latest HTTP/1.1" 200 284 "-" "-"
172.26.0.6 - - [31/Aug/2023:10:00:48 -0400] "GET /api/speedtest/latest HTTP/1.1" 200 282 "-" "-"
`

@Twit123
Copy link

Twit123 commented Aug 31, 2023

Hi,

Just posting that I have the exact same issue as explained above. The initial login screen just has 500 : Server Error on it and I get the above error in the logs.

FYI..The API still works as Homepage still shows the speeds.

Regards

Simon

@alexdelprete
Copy link
Contributor

alexdelprete commented Aug 31, 2023

You need the APP_KEY env variable: I have these in my docker-compose.yml environment section:

(the APP_KEY was generated automatically in the .env file first time I installed ST, I moved all variables from there and put them in docker-compose.yml)

      APP_NAME: "HomeLab Speedtest Tracker"
      APP_ENV: production
      APP_KEY: base64:tdP72KJ+yxxxxxxxxxxxxxxxxZy1GeM6mbpr+1tbv4=
      APP_DEBUG: false
      APP_URL: http://speedtest.domain.net

You can generate a new APP_KEY from the container's shell:

$ docker exec -it speedtest-tracker php artisan key:generate --show
base64:9IhKvpWXZ1tuhpN3ENFDLurQpEj4fngQvVr5KWu4rFo=

@kimpenhaus
Copy link

It was/is in the .env file and that was working before. I think you mentioned an issue with reading the .env in another bug

@alexjustesen
Copy link
Owner

alexjustesen commented Aug 31, 2023

@akalderon @Twit123 @kimpenhaus: I was just chatting with @alexdelprete and I'll be making a change so we can completely remove the need for the .env file.

In the meantime pass APP_KEY: putyourbase64keyhere as an environment variable and that should solve your issue. You can either copy the value from your mounted .env file or generate a new one by running docker exec -it speedtest-tracker php artisan key:generate --show on the host machine or php artisan key:generate --show from within the container.

Once the environment variable is set you'll need to restart your container for it to take effect.

Note: the app key is used for encryption which currently isn't used except for sessions. It'll log you out but will have no other effects in the app.

@kimpenhaus
Copy link

kimpenhaus commented Aug 31, 2023

@alexjustesen that fixed it ... thanks - could I delete the .env file than? or is it in a future release?

@alexjustesen
Copy link
Owner

@alexjustesen that fixed it ... thanks - could I delete the .env file than? or is it in a future release?

You can leave it, currently if its missing on startup it's going to recreate it.

@alexdelprete
Copy link
Contributor

that fixed it ... thanks

Please close the issue if it's ok now.

@alexjustesen
Copy link
Owner

@akalderon verifying with you before closing the issue as you're OP

@rogermeireles
Copy link

Ok, I just started with docker, I'll try it now

@rogermeireles
Copy link

rogermeireles commented Sep 1, 2023

You need the APP_KEY env variable: I have these in my docker-compose.yml environment section:

(the APP_KEY was generated automatically in the .env file first time I installed ST, I moved all variables from there and put them in docker-compose.yml)

      APP_NAME: "HomeLab Speedtest Tracker"
      APP_ENV: production
      APP_KEY: base64:tdP72KJ+yxxxxxxxxxxxxxxxxZy1GeM6mbpr+1tbv4=
      APP_DEBUG: false
      APP_URL: http://speedtest.domain.net

You can generate a new APP_KEY from the container's shell:

$ docker exec -it speedtest-tracker php artisan key:generate --show
base64:9IhKvpWXZ1tuhpN3ENFDLurQpEj4fngQvVr5KWu4rFo=

A doubt, did you insert the env variables directly into the yaml?

right in the field below

environment:
  - PUID=1000
  - PGID=1000

@alexdelprete
Copy link
Contributor

alexdelprete commented Sep 1, 2023

A doubt, did you insert the env variables directly into the yaml?

As I wrote: "I have these in my docker-compose.yml environment section".

version: '3.3'
services:
  speedtest-tracker:
    image: ghcr.io/alexjustesen/speedtest-tracker:v0.11.20
    container_name: speedtest-tracker
    restart: unless-stopped
    ports:
      - 8008:443
    environment:
      #TZ: Europe/Rome
      PUID: 1000
      PGID: 1000
      DB_CONNECTION: mysql
      DB_HOST: mariadb.axel.dom
      DB_PORT: 3306
      DB_DATABASE: speedtest_tracker
      DB_USERNAME: ------
      DB_PASSWORD: --------
      TELEGRAM_BOT_TOKEN: '631yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyxxxxxxxxx6491vwA'
      APP_NAME: "OSIlife Speedtest Tracker"
      APP_KEY: base64:tdP72KJ+xxxxxxxxxxxxxxxxxxxxxxxxxxxxtbv4=
      APP_URL: http://speedtest.axel.dom
      FORCE_HTTPS: false
      SSL_MODE: mixed
      DASHBOARD_POLLING: 180
      NOTIFICATION_POLLING: 180
      RESULTS_POLLING: 180
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - $PWD/config:/config
      - $PWD/certs:/etc/ssl/web

@rogermeireles
Copy link

thank you very much, I will apply the correction

@chandz05
Copy link

chandz05 commented Sep 1, 2023

Just wanted to chime in and say my db connection issues and 500 refused errors have been resolved on docker in UnRaid. For Community Applications speedtest-tracker image, I had to explicitly add DB details as env variables as well as the APP_KEY variable (as per the comments above). Previously this was not required. Thanks!

@akalderon
Copy link
Author

@alexdelprete - sorry for the delay as I was busy elsewhere - confirmed - the APP_KEY did the trick - thank you very much

@alexdelprete
Copy link
Contributor

@alexdelprete - sorry for the delay as I was busy elsewhere - confirmed - the APP_KEY did the trick - thank you very much

great. can you close the issue please? thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants