4

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

DR dre
  • 41
  • 2

1 Answers1

1

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
Jacopo Pace
  • 460
  • 7
  • 14
  • 1
    It worked, so thanks! However this was a bit confusing as the official instructions at https://docs.directus.io/guides/installation/docker/ say that you could simply run `run -p 8055:8055 directus/directus` and it should work... – Redoman Oct 05 '21 at 15:46
  • 1
    Yep. Anyway, it seems they just fixed the problem in the new document pages: https://docs.directus.io/getting-started/installation/docker/ – Jacopo Pace Nov 03 '21 at 01:38