#!/bin/bash
# Find valid Vertex AI regions
PROJECT_ID="amgn-app"
echo "======================================"
echo "🔍 Finding Valid Vertex AI Regions"
echo "======================================"
echo ""
echo "📝 Method 1: Check Vertex AI API regions..."
echo "Common Vertex AI regions:"
echo " - us-central1 (Iowa, USA) - Recommended"
echo " - us-east1 (South Carolina, USA)"
echo " - us-east4 (Northern Virginia, USA)"
echo " - us-west1 (Oregon, USA)"
echo " - us-west4 (Las Vegas, USA)"
echo " - europe-west1 (Belgium)"
echo " - europe-west4 (Netherlands)"
echo " - asia-southeast1 (Singapore)"
echo " - asia-northeast1 (Tokyo, Japan)"
echo ""
echo "📝 Method 2: Check enabled APIs..."
gcloud services list --enabled --project=$PROJECT_ID | grep aiplatform || echo "Vertex AI API may not be enabled in some regions"
echo ""
echo "📝 Method 3: Test a region (us-central1)..."
echo "Testing if us-central1 is available..."
echo ""
# Check if Vertex AI is available in us-central1
gcloud ai models list --region=us-central1 --project=$PROJECT_ID --limit=1 2>&1 | head -5 || echo "Note: This just checks API availability"
echo ""
echo "✅ Most Common Valid Regions:"
echo " - us-central1 (Recommended - most common)"
echo " - us-east1"
echo " - us-west1"
echo ""
echo "⚠️ ACTION REQUIRED:"
echo "1. Go to Vercel Dashboard → Settings → Environment Variables"
echo "2. Find GCP_LOCATION"
echo "3. Change from 'global' to 'us-central1' (or another valid region)"
echo "4. Save and redeploy"
echo ""