๐ง Fixing Your Vercel Deployment Crash
๐ What the Error Means
The message "Serverless Function has crashed" means your api/trends.js file is either missing, misnamed, broken, or Vercel couldn't run it properly.
✅ Fix Checklist
1️⃣ GitHub Repo Structure
hashtag-rotator-service/ ├── api/ │ └── trends.js ├── package.json └── README.md
trends.jsmust be inside theapi/folderpackage.jsonmust listaxiosandcheerio
2️⃣ trends.js Format Check
Start with:
import axios from 'axios';
End with:
export default async function handler(req, res) { ... } If you use module.exports or forget export default, Vercel won't detect it as a proper route.
3️⃣ Re-deploy Your Project
- Go to Vercel Dashboard
- Open your project → Deployments tab → Click Redeploy
- Use:
- Framework Preset:
Other - Root Directory:
.(just a dot)
- Framework Preset:
๐งช Test the Endpoint
Once deployed, test:
https://hashtag-rotator-service.vercel.app/api/trends?region=kenya
You should see:
{ "hashtags": ["#Ngong", "#SabaSaba2025", "#JusticeForJuliaNjoki", ...] } ๐ง Need Help?
I can walk through your file, Vercel form, or deployment logs with you. Let’s get Kenya’s civic signals flowing smoothly — no crashes, just clarity ๐ฌ✅
No comments:
Post a Comment