Express-session deprecated req.secret; provide secret option

Viewed 753

hi i typed (npx directus start) and this is what it showed me :

express-session deprecated req.secret; provide secret option node_modules/directus/dist/middleware/session.js:29:44 15:09:53 "KEY" Environment Variable is missing.

help pls

1 Answers

You are probably missing the .env file or maybe it has been corrupted for some reason. So, you just need to create it (if you have none) then add this into:

KEY="your-random-key-string"
SECRET="your-random-secret-string"

Otherwise, you can also put "env" variables directly on the command line:

KEY="your-random-key-string" SECRET="your-random-secret-string" npx directus start

Bonus: I had the same problem by using docker in a basic way (without docker compose) and I solved like this:

docker run -p 8055:8055 \
-e KEY="1B64d95c-2346-43fA-bF51-bc9993dc7a27" \
-e SECRET="sSdqSAT7mw_nFGyPsR3f1qRyzp_TjqEr" \
directus/directus
Related