Skip to content

fix(report): trim ANTHROPIC_API_KEY so stray newline can't 401 triage#100

Merged
abdout merged 1 commit into
mainfrom
fix/report-anthropic-key-trim
May 22, 2026
Merged

fix(report): trim ANTHROPIC_API_KEY so stray newline can't 401 triage#100
abdout merged 1 commit into
mainfrom
fix/report-anthropic-key-trim

Conversation

@abdout
Copy link
Copy Markdown
Contributor

@abdout abdout commented May 22, 2026

Summary

Context (production incident)

While verifying the report fix end-to-end, prod logs surfaced two more broken env vars:

  • AUTH_SECRET missingMissingSecret on every request (auth broken site-wide). Fixed out of band (generated + set in prod).
  • ANTHROPIC_API_KEY invalid → currently a junk value (\nn\n); needs a valid key. Triage degrades gracefully (reports still land as needs-human).

Changes

  • src/lib/report/triage.ts: .trim() the Anthropic key.

Test plan

  • tsc clean for touched file.
  • Report submission verified working end-to-end on prod (issue created + closed).
  • After a valid ANTHROPIC_API_KEY is set: confirm triage classifies (no 401 in logs).

🤖 Generated with Claude Code

Same env-newline class as the GITHUB token fix (#97): a trailing newline in
ANTHROPIC_API_KEY makes Anthropic reject the request with 401 invalid x-api-key,
silently dropping AI triage and forcing every report into needs-human. Trim the
key at read time. (Production AUTH_SECRET was also missing — set out of band — and
the prod ANTHROPIC_API_KEY value is currently junk pending a valid key.)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
kun Building Building Preview, Comment May 22, 2026 5:04pm

@abdout abdout merged commit a50688e into main May 22, 2026
1 of 2 checks passed
@abdout abdout deleted the fix/report-anthropic-key-trim branch May 22, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant