Each message below is quoted exactly as the agent or the setup code prints it.
Plain-text copy for AI assistants: /docs/troubleshooting/agent.md
LAWDE Shield · Documentation
Exact @lawdeshield/agent messages — “[LawdeAgent] apiKey is required”, “[LAWDE] LAWDE_API_KEY missing” — and what to check when errors never reach LAWDE.
Each message below is quoted exactly as the agent or the setup code prints it.
Plain-text copy for AI assistants: /docs/troubleshooting/agent.md
The agent never throws into your app and does not print LAWDE’s reply. When LAWDE refuses an error (a bad key, a limit), the agent keeps it in a small in-memory queue and moves on. To find the reason:
npx @lawdeshield/cli init again. Both show LAWDE’s exact reply.instrumentation.ts exports onRequestError. Without it, errors Next.js catches itself (a typical API 500) never reach the agent.LAWDE_API_KEY is set where the app runs, not only in your local env file.[LawdeAgent] apiKey is requiredWhere: Thrown by new LawdeAgent(...)
What it means: new LawdeAgent() was called with an empty apiKey, usually because process.env.LAWDE_API_KEY is not set where the code runs.
Fix:
LAWDE_API_KEY in that environment, or guard the constructor so the app starts without LAWDE when the key is missing.[LAWDE] LAWDE_API_KEY missing — live crash capture disabledWhere: Server log at startup (Next.js instrumentation.ts)
What it means: The Next.js server started without LAWDE_API_KEY, so the agent was not created and no errors are sent.
Fix:
LAWDE_API_KEY to the environment of that deployment (on Vercel: vercel env add LAWDE_API_KEY production) and redeploy.[LAWDE] LAWDE_API_KEY missing — crash capture disabledWhere: Server log at startup (Medusa initLawde)
What it means: initLawde() found no LAWDE_API_KEY, so it sent nothing.
Fix:
LAWDE_API_KEY on every Medusa host, then restart.[LawdeAgent] captureException failedWhere: Server log, only with debug: true
What it means: Building or sending the report threw. The agent never throws into your app; with debug: true it logs the cause next to this line.
Fix:
debug off again once fixed.