ProjectsAdmin Panel
Vercel Environment Variables Setup
Health Analytics API Integration
Vercel Environment Variables Setup
Health Analytics API Integration
Required Environment Variables for Vercel
Add the following environment variable to your Vercel project:
Production Environment
# Health Analytics API (GCP Cloud Run)
HEALTH_ANALYTICS_API_URL=https://health-analytics-service-222426967009.us-east1.run.appHow to Add in Vercel Dashboard
- Go to https://vercel.com/your-project/settings/environment-variables
- Click "Add New" button
- Enter:
- Key:
HEALTH_ANALYTICS_API_URL - Value:
https://health-analytics-service-222426967009.us-east1.run.app - Environment: Select "Production", "Preview", and "Development"
- Key:
- Click "Save"
- Redeploy your application for changes to take effect
Verification
After deployment, verify the variable is loaded:
# Check Vercel logs during deployment
vercel logs --follow
# Or test the API endpoint directly
curl https://your-app.vercel.app/api/health/analyticsExpected response:
{
"status": "healthy",
"service": "health-analytics",
"mongodb": "connected",
"timestamp": "2025-11-17T..."
}Existing Environment Variables
Ensure these variables are also set in Vercel:
# MongoDB
MONGODB_URI=mongodb+srv://...
MONGODB_DB_NAME=crop_prod
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_...
CLERK_SECRET_KEY=sk_...
# Search Service (via API Gateway - recommended)
SEARCH_SERVICE_URL=https://crop-gateway-2u6j9u5d.ue.gateway.dev
# Direct Cloud Run URL (for debugging only):
# SEARCH_SERVICE_URL=https://search-service-222426967009.us-east1.run.app
# DIS (Dealer Information System) - Clinton Tractor Inventory
# Optional - enables real-time dealer inventory widget on dashboard
DIS_API_KEY=your-dis-api-key
# DIS_API_URL=https://cl2342.disprism.com # default, no need to set
# DIS_DEALER_ID=C # default, no need to setLocal Development
For local development, the variable is already added to .env.local:
HEALTH_ANALYTICS_API_URL=https://health-analytics-service-222426967009.us-east1.run.appNo additional setup needed for local development.
Troubleshooting
If API calls fail after deployment:
- Check Vercel environment variables are set correctly
- Verify API URL is accessible:
curl https://health-analytics-service-222426967009.us-east1.run.app/health - Check Vercel function logs for errors
- Ensure CORS is enabled on the Health Analytics service (already configured)
If you see "Unable to Load Data" error:
- Check browser network tab for failed requests
- Verify the API route is proxying correctly:
/api/health/analytics/coverage - Check Vercel function logs for error details
- Ensure MongoDB connection is working