- Cron is configured in
vercel.json - Cron Jobs are ENABLED in Vercel dashboard
- Manual execution works (114/204 stocks updated)
- Code is deployed (commit: 4d09e85)
- Problem: Groww API is rate-limiting requests
- Impact: Only 114 out of 204 stocks are being updated
- Error:
HTTP 429 for IDFCFIRSTB, KOTAKBANK, HDFCBANK, etc. - Fix Applied:
- Reduced batch size from 5 → 3
- Increased delay from 1s → 2s between batches
- Action Required: Deploy these changes
- Problem: Cron may not be triggering automatically from Vercel
- Evidence:
- Manual execution works
- No "Last Run" or "Next Run" shown in Vercel dashboard
- Other crons are running, but this one might not be
- Go to https://vercel.com/dashboard
- Select your project → Logs tab
- Filter by:
/api/cron/update-stock-snapshots - Look for automatic executions (every 3 minutes)
- Check timestamps - should be: 05:00, 05:03, 05:06, 05:09, etc. (UTC)
What to look for:
[STOCK-SNAPSHOTS] Starting update at 2026-01-16T05:00:00.000Z
[STOCK-SNAPSHOTS] Fetching data for 204 stocks
[STOCK-SNAPSHOTS] ✅ Updated 114 stocks in database
Even though the dashboard shows "Enabled", sometimes crons need to be:
- Disabled and Re-enabled: Toggle off, wait 10 seconds, toggle back on
- Redeployed: Push a new commit to trigger re-registration
- Current schedule:
*/3 3-10 * * * - Means: Every 3 minutes, between 03:00-10:59 UTC
- Current time: ~05:00 UTC ✅ (within window)
Sometimes Vercel needs a fresh deployment to properly register crons:
# Make a minor change and redeploy
git commit --allow-empty -m "Trigger cron re-registration"
git push origin main- Go to Settings → Cron Jobs
- Find
/api/cron/update-stock-snapshots - Disable it (toggle off)
- Wait 10 seconds
- Enable it again (toggle on)
- Check logs after 3 minutes
Changes made to reduce rate limiting:
BATCH_SIZE: 5 → 3DELAY: 1000ms → 2000ms
Deploy these changes:
git add app/api/cron/update-stock-snapshots/route.ts
git commit -m "Fix rate limiting: reduce batch size and increase delay"
git push origin mainOnce working correctly, you should see:
- Vercel Logs: New entry every 3 minutes
- Database:
stock_snapshotstable updated every 3 minutes - Success Rate: Higher than 114/204 (less rate limiting)
If Vercel cron continues to fail, use GitHub Actions:
Create .github/workflows/stock-snapshots-cron.yml:
name: Stock Snapshots Cron
on:
schedule:
- cron: '*/3 3-10 * * *'
workflow_dispatch:
jobs:
update-stock-snapshots:
runs-on: ubuntu-latest
steps:
- name: Trigger Stock Snapshots
run: |
curl -X GET "https://www.ectrade.in/api/cron/update-stock-snapshots" \
-H "Authorization: Bearer ${{ secrets.CRON_SECRET }}"Then add CRON_SECRET to GitHub repository secrets.
- Deploy the rate limiting fixes (commit and push)
- Check Vercel logs for automatic executions
- If still not running: Toggle cron off/on in dashboard
- If still failing: Set up GitHub Actions fallback
Run this script to check:
./check-stock-snapshots-cron.shThen check Vercel logs to see if automatic executions are happening.