Skip instead of failing discount cron on Stripe permission errors - #3990
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThe discount code cron POST route now detects a specific "This application does not have the required permissions" error, logs it at warning level via logAndRespond, and returns early instead of rethrowing. ChangesDiscount Code Cron Permission Error Handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/web/app/`(ee)/api/cron/discount-codes/create/route.ts:
- Around line 101-104: The permission-check branch currently assumes caught
errors are Error objects and calls error.message.includes(...), which can throw
for non-Error throws; update the catch block in route.ts to first guard the
check (e.g., use "error instanceof Error && error.message.includes(...)" or
verify typeof error === 'object' && 'message' in error) before calling includes,
so non-Error values (strings/plain objects) won't cause a new exception and the
original error handling logic (the permission branch and fallback) remains
intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4c27a1e8-04e0-4dd6-a2e0-b6dae0c2a93d
📒 Files selected for processing (1)
apps/web/app/(ee)/api/cron/discount-codes/create/route.ts
Summary by CodeRabbit