You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2026-04-21 15:41:20 +00:00: SECURITY ERROR: TOKEN_SECRET environment variable must be set in production
2026-04-21 15:41:20 +00:00: Generate one with: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
I do not have node command yet for now as user jss, but nvm and node 24.xy are present
config.json works because pm2 isn't started with --env production, so NODE_ENV stays unset. JSS falls through to a dev path: generates a random secret per process and logs a warning (tokens don't survive restarts, but the server runs).
ecosystem.config.js sets env_production: { NODE_ENV: 'production' }. With NODE_ENV=production and no TOKEN_SECRET, JSS exits on purpose (src/auth/token.js hard-fails to force the operator to pick a stable secret).
Committing a secret directly to the repo isn't best-practice long-term — once it works, you can move it to a root-owned /etc/jss/token.secret file sourced by a small wrapper, or an env_file. But for a first working deployment, the inline value is the minimum-friction path.
Upstream
Filed JavaScriptSolidServer/JavaScriptSolidServer#280 to make JSS auto-generate and persist a secret on first run — so new operators don't hit this at all. Once that lands you won't need any of the above.
Activity
melvincarvalho commentedon Apr 21, 2026
Diagnosis
The difference is
NODE_ENV:config.jsonworks because pm2 isn't started with--env production, soNODE_ENVstays unset. JSS falls through to a dev path: generates a random secret per process and logs a warning (tokens don't survive restarts, but the server runs).ecosystem.config.jssetsenv_production: { NODE_ENV: 'production' }. WithNODE_ENV=productionand noTOKEN_SECRET, JSS exits on purpose (src/auth/token.jshard-fails to force the operator to pick a stable secret).Quick fix (3 steps, no
nodeneeded)ecosystem.config.js:Committing a secret directly to the repo isn't best-practice long-term — once it works, you can move it to a root-owned
/etc/jss/token.secretfile sourced by a small wrapper, or anenv_file. But for a first working deployment, the inline value is the minimum-friction path.Upstream
Filed JavaScriptSolidServer/JavaScriptSolidServer#280 to make JSS auto-generate and persist a secret on first run — so new operators don't hit this at all. Once that lands you won't need any of the above.
ewingson commentedon Apr 22, 2026
close 2026-04-22