Troubleshooting
Common issues and how to resolve them.
Webhooks Not Firing
Symptoms: Payments succeed but credits aren't granted.
- Check Stripe Dashboard → Webhooks for delivery logs
- Verify
STRIPE_WEBHOOK_SECRETmatches your Stripe settings - Ensure webhook endpoint is publicly accessible
- Check server logs for signature verification errors
Annual Credits Not Auto-Granting
Symptoms: Users on yearly plans don't receive monthly credits.
- Verify cron job is running (check
/api/cron/subscription-grants) - Check
subscriptionCreditSchedule/subscription_credit_schedulefornextGrantAt/next_grant_attimestamps - Ensure
CRON_SECRETis configured correctly
Expiring Credits Not Updating
Symptoms: Daily login credits remain available after their expiry time.
- Verify cron job is running for
/api/cron/credit-expiry - Check
creditBalanceBucket/credit_balance_bucketrows with expiredexpiresAt/expires_atvalues and positiveremainingAmount/remaining_amount - Ensure
CRON_SECRETor cron basic auth credentials are configured correctly
AI Tool Generation Fails
- Verify
VOLCENGINE_API_KEY,VOLCENGINE_BASE_URL, andVOLCENGINE_MODEL - Confirm the server runtime can reach the Volcengine endpoint
- Check
aiGeneration/ai_generationrows for failed generation records and error messages - Confirm the user has enough credits before generation
User Can't Access Admin Panel
- Confirm
user.role = 'admin'in the database - Check
requireAdmin()inmodules/auth/admin.ts - Ensure the user's session is valid (try logging out and back in)
Email Not Sending
- Verify
RESEND_API_KEYandRESEND_FROM_EMAIL - If using
onboarding@resend.dev, send only to the email registered on your Resend account - For production, confirm the sending domain is verified in Resend
- Check Resend email logs for delivery failures
Database Connection Issues
- Verify
DATABASE_URLconnection string - Ensure
?sslmode=requirefor cloud databases - Check if your IP is allowlisted (if using IP restrictions)
- Try connecting directly:
psql $DATABASE_URL
Build Errors After Upgrade
If you encounter TypeScript errors after upgrading dependencies:
# Clear Next.js cache
rm -rf .next
# Reinstall dependencies
pnpm install
# Try building again
pnpm build