KeystoneJS Configuration Error: Please provide a `cookie secret` value for session encryption.
When I deployed a KeystoneJS app to Heroku, I got the error KeystoneJS Configuration Error: Please provide a cookie secret
value for session encryption.
The cause was simply not setting the COOKIE_SECRET environment variable, but I’ll explain the solution in detail.
As written Please provide a cookie secret
value for session encryption., it seems a server error occurred because the Cookie secret wasn’t set in the environment variables.
Error Message
app[web.1]: Please provide a `cookie secret` value for session encryption.
app[web.1]: KeystoneJS Configuration Error:
app[web.1]:
heroku[web.1]: State changed from starting to crashed
heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=yourapp.herokuapp.com request_id=ea5e5a58-56bb-4d49-a78d-accc4f13962e
In the development environment, the COOKIE_SECRET value is written in the .env file. Set this same environment variable in production and restart the server to resolve the issue.
COOKIE_SECRET=YOUR_COOKIE_SECRET_XXX
In this case, since it’s a Heroku app, you can restart with a command like:
heroku restart --app your_app_name
That’s all from the Gemba.