fix(slack): use validated env for Anthropic API key#1067
Conversation
The Anthropic SDK defaulted to process.env.ANTHROPIC_API_KEY which was not set in the Vercel deployment. Pass the key explicitly via the validated env.ts config. - Add ANTHROPIC_API_KEY to API env.ts as required - Pass env.ANTHROPIC_API_KEY to Anthropic client in run-agent.ts - Add to deploy-preview and deploy-production workflows - Remove unused ANTHROPIC_API_KEY from trpc env.ts
📝 WalkthroughWalkthroughThis pull request adds ANTHROPIC_API_KEY environment variable configuration across the codebase. The key is added to GitHub Actions deployment workflows, integrated into environment schemas, and used for Anthropic client initialization in the Slack agent service. Changes
Possibly Related PRs
Poem
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 Preview Deployment🔗 Preview Links
Preview updates automatically with new commits |
Summary
process.env.ANTHROPIC_API_KEYwhich wasn't set in Vercel deployments, causingCould not resolve authentication methoderrorsenv.ANTHROPIC_API_KEYfrom the API'senv.ts(Zod-validated at build time)ANTHROPIC_API_KEYto deploy-preview and deploy-production workflowsANTHROPIC_API_KEYfrom trpcenv.tsTest plan
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.