Skip to content

Add timeout to Anthropic API calls in webhook#626

Merged
bokelley merged 2 commits into
mainfrom
bokelley/email-tracking-fix-2
Jan 5, 2026
Merged

Add timeout to Anthropic API calls in webhook#626
bokelley merged 2 commits into
mainfrom
bokelley/email-tracking-fix-2

Conversation

@bokelley

@bokelley bokelley commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Email webhook was hanging at insight extraction (Anthropic API call)
  • Added 25s timeout to prevent indefinite hangs
  • Added logging before API call to track progress

Root cause

The diagnostic logging from PR #623 revealed the webhook stops at "Starting insight extraction" - the Anthropic API call is not returning.

Changes

  • Wrap Anthropic API call with Promise.race timeout (25s)
  • Add logging before API call: "Calling Anthropic API"
  • If timeout occurs, falls back to simple extraction (existing error handling)

Test plan

  • Deploy and send test email
  • Verify logs show "Calling Anthropic API"
  • Either API succeeds and email is tracked, or timeout triggers fallback

🤖 Generated with Claude Code

bokelley and others added 2 commits January 5, 2026 11:00
The webhook was hanging at insight extraction. Added:
- 25s timeout to prevent indefinite hangs
- Logging before API call to track progress

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bokelley bokelley merged commit 0ff77bf into main Jan 5, 2026
6 checks passed
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