← back to Norma
norma-scraper: load .env.local via interpreter_args so SESSION_SECRET reaches the cron — fixes 401 loop
071374856c4d4d1eb6d08071315c4c96142aef5f · 2026-05-28 16:54:45 -0700 · Steve Abrams
scripts/scraper-cron.js builds an inline session token using SESSION_SECRET.
Without --env-file, the cron's secret was empty, signature mismatched the
server's HMAC, server returned 401, cron exited, pm2 restarted it every
~2 min. norma-credential-health already had this fix; norma-scraper didn't.
Mirrors the norma-credential-health pattern (interpreter+interpreter_args).
2026-05-28 fix surfaced by yolo task 49.
Files touched
Diff
commit 071374856c4d4d1eb6d08071315c4c96142aef5f
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Thu May 28 16:54:45 2026 -0700
norma-scraper: load .env.local via interpreter_args so SESSION_SECRET reaches the cron — fixes 401 loop
scripts/scraper-cron.js builds an inline session token using SESSION_SECRET.
Without --env-file, the cron's secret was empty, signature mismatched the
server's HMAC, server returned 401, cron exited, pm2 restarted it every
~2 min. norma-credential-health already had this fix; norma-scraper didn't.
Mirrors the norma-credential-health pattern (interpreter+interpreter_args).
2026-05-28 fix surfaced by yolo task 49.
---
ecosystem.config.js | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ecosystem.config.js b/ecosystem.config.js
index 29ccd9e..b4a96c1 100644
--- a/ecosystem.config.js
+++ b/ecosystem.config.js
@@ -18,6 +18,11 @@ module.exports = {
name: 'norma-scraper',
script: 'scripts/scraper-cron.js',
cwd: '/root/Projects/Norma',
+ interpreter: 'node',
+ // Load SESSION_SECRET (and rest of .env.local) so the inline session
+ // token the cron builds matches the server's HMAC. Without this the
+ // cron fires HTTP 401 every 2 min (signature mismatch). 2026-05-28 fix.
+ interpreter_args: '--env-file=/root/Projects/Norma/.env.local',
// 14:00 UTC = 6:00 AM Pacific Time
cron_restart: '0 14 * * *',
autorestart: false, // Don't restart after exit — wait for cron
← 44cdbed defensive: explicit body[data-inbox-theme='classic-dense'] s
·
back to Norma
·
wire Morning Batch + weekly_intelligence to PM2 cron — fixes 36d0cb1 →