Description
Summary
CRON_SECRET is required to operate the app in cloud mode, but it is missing from both .env.example files — so nothing reminds an operator to set it, and the internal endpoints permanently return 401.
Where it's used
Server — guards three internal endpoints (server/src/server.js):
server.js:155—/api/internal/daily-trackingserver.js:177—/api/internal/content/:id/briefserver.js:213—/api/internal/trigger-tracking
Each guard is if (!process.env.CRON_SECRET || secret !== process.env.CRON_SECRET) → 401. When the var is unset, the first clause is always true, so every call to these endpoints returns 401 no matter what the caller sends.
These are documented as CRON_SECRET-protected in server/README.md (the internal-endpoints table).
Web — sends / checks the same secret (must match the server's value):
web/src/app/api/cron/daily-tracking/route.ts— Vercel Cron entrypointweb/src/app/api/stripe/success/route.ts— post-checkout tracking triggerweb/src/lib/mcp/data.ts— MCP brief generation (throwsCRON_SECRET must be configuredwhen missing)
Impact
In a cloud deploy, if the operator never sets CRON_SECRET (because it isn't in the example files), daily tracking cron, content-brief generation, and post-checkout tracking all fail — the server side 401s and the MCP path throws. Self-hosted/local users who never hit these paths won't notice, which is why it's easy to miss.
Suggested fix
Add a documented CRON_SECRET entry to both example files:
Include a comment noting that:
- it's cloud-only (needed when Vercel Cron / the Stripe success route / the MCP layer call the server's internal endpoints), and
- the same value must be set on both the web app and the server, since the web side sends
Authorization: Bearer ${CRON_SECRET}and the server compares against its own copy.
Docs/config only — no code changes.
Activity
docs(env): add CRON_SECRET to both .env.example files
docs(env): add CRON_SECRET to both .env.example files (#277)