fix(report): trim ANTHROPIC_API_KEY so stray newline can't 401 triage#100
Merged
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ANTHROPIC_API_KEYat read time intriage.tsso a stray trailing newline can't cause401 invalid x-api-keyand silently disable AI triage.Context (production incident)
While verifying the report fix end-to-end, prod logs surfaced two more broken env vars:
AUTH_SECRETmissing →MissingSecreton every request (auth broken site-wide). Fixed out of band (generated + set in prod).ANTHROPIC_API_KEYinvalid → currently a junk value (\nn\n); needs a valid key. Triage degrades gracefully (reports still land asneeds-human).Changes
src/lib/report/triage.ts:.trim()the Anthropic key.Test plan
tscclean for touched file.🤖 Generated with Claude Code