|
| 1 | +# Vercel Deployment Setup Guide |
| 2 | + |
| 3 | +This guide will help you set up Vercel deployment for the CocoaFlow API specification. |
| 4 | + |
| 5 | +## Current Issue |
| 6 | + |
| 7 | +The error `Project not found` indicates that either: |
| 8 | + |
| 9 | +1. The Vercel project doesn't exist yet |
| 10 | +2. The project ID or organization ID is incorrect |
| 11 | +3. The Vercel token doesn't have access to the project |
| 12 | + |
| 13 | +## Solution Steps |
| 14 | + |
| 15 | +### Option 1: Create a New Vercel Project (Recommended) |
| 16 | + |
| 17 | +1. **Install Vercel CLI**: |
| 18 | + |
| 19 | + ```bash |
| 20 | + npm install -g vercel |
| 21 | + ``` |
| 22 | + |
| 23 | +2. **Login to Vercel**: |
| 24 | + |
| 25 | + ```bash |
| 26 | + vercel login |
| 27 | + ``` |
| 28 | + |
| 29 | +3. **Deploy the project**: |
| 30 | + |
| 31 | + ```bash |
| 32 | + cd project-api_spec |
| 33 | + vercel --prod |
| 34 | + ``` |
| 35 | + |
| 36 | +4. **Get the project details**: |
| 37 | + After deployment, Vercel will show you: |
| 38 | + - Project ID |
| 39 | + - Organization ID |
| 40 | + - Deployment URL |
| 41 | + |
| 42 | +5. **Update GitHub Secrets**: |
| 43 | + Go to your GitHub repository → Settings → Secrets and variables → Actions |
| 44 | + Update these secrets: |
| 45 | + - `VERCEL_TOKEN`: Your Vercel token (get from https://vercel.com/account/tokens) |
| 46 | + - `VERCEL_ORG_ID`: The organization ID from step 4 |
| 47 | + - `VERCEL_PROJECT_ID`: The project ID from step 4 |
| 48 | + |
| 49 | +### Option 2: Link to Existing Project |
| 50 | + |
| 51 | +If you already have a Vercel project: |
| 52 | + |
| 53 | +1. **Link to existing project**: |
| 54 | + |
| 55 | + ```bash |
| 56 | + cd project-api_spec |
| 57 | + vercel link |
| 58 | + ``` |
| 59 | + |
| 60 | +2. **Follow the prompts** to select your existing project |
| 61 | + |
| 62 | +3. **Get project details**: |
| 63 | + |
| 64 | + ```bash |
| 65 | + vercel project ls |
| 66 | + ``` |
| 67 | + |
| 68 | +4. **Update GitHub secrets** with the correct values |
| 69 | + |
| 70 | +### Option 3: Manual Project Creation |
| 71 | + |
| 72 | +1. **Go to Vercel Dashboard**: https://vercel.com/dashboard |
| 73 | + |
| 74 | +2. **Create New Project**: |
| 75 | + - Click "New Project" |
| 76 | + - Import your GitHub repository |
| 77 | + - Configure the project settings |
| 78 | + |
| 79 | +3. **Get Project Details**: |
| 80 | + - Go to Project Settings |
| 81 | + - Copy the Project ID and Organization ID |
| 82 | + |
| 83 | +4. **Update GitHub Secrets** |
| 84 | + |
| 85 | +## GitHub Secrets Configuration |
| 86 | + |
| 87 | +### Required Secrets |
| 88 | + |
| 89 | +| Secret Name | Description | How to Get | |
| 90 | +| ------------------- | ---------------- | --------------------------------- | |
| 91 | +| `VERCEL_TOKEN` | Vercel API token | https://vercel.com/account/tokens | |
| 92 | +| `VERCEL_ORG_ID` | Organization ID | From Vercel dashboard or CLI | |
| 93 | +| `VERCEL_PROJECT_ID` | Project ID | From Vercel dashboard or CLI | |
| 94 | + |
| 95 | +### Setting Up Secrets |
| 96 | + |
| 97 | +1. Go to your GitHub repository |
| 98 | +2. Click **Settings** → **Secrets and variables** → **Actions** |
| 99 | +3. Click **New repository secret** |
| 100 | +4. Add each secret with the correct name and value |
| 101 | + |
| 102 | +## Alternative: GitHub Pages Only |
| 103 | + |
| 104 | +If you prefer to use only GitHub Pages (which is already working): |
| 105 | + |
| 106 | +1. **Remove Vercel deployment** from the CI workflow |
| 107 | +2. **Keep only GitHub Pages deployment** |
| 108 | + |
| 109 | +The API documentation will still be available at: |
| 110 | +`https://[your-username].github.io/[repo-name]/` |
| 111 | + |
| 112 | +## Testing the Configuration |
| 113 | + |
| 114 | +After updating the secrets: |
| 115 | + |
| 116 | +1. **Push a change** to trigger the CI workflow |
| 117 | +2. **Check the workflow logs** for Vercel deployment status |
| 118 | +3. **Verify the deployment** at your Vercel URL |
| 119 | + |
| 120 | +## Troubleshooting |
| 121 | + |
| 122 | +### Common Issues |
| 123 | + |
| 124 | +1. **"Project not found"**: |
| 125 | + - Verify project ID and org ID are correct |
| 126 | + - Ensure the Vercel token has access to the project |
| 127 | + |
| 128 | +2. **"Token invalid"**: |
| 129 | + - Generate a new token at https://vercel.com/account/tokens |
| 130 | + - Update the `VERCEL_TOKEN` secret |
| 131 | + |
| 132 | +3. **"Permission denied"**: |
| 133 | + - Ensure your Vercel account has access to the organization |
| 134 | + - Check if the project is in the correct organization |
| 135 | + |
| 136 | +### Debugging Commands |
| 137 | + |
| 138 | +```bash |
| 139 | +# Check Vercel CLI status |
| 140 | +vercel whoami |
| 141 | + |
| 142 | +# List projects |
| 143 | +vercel project ls |
| 144 | + |
| 145 | +# Get project details |
| 146 | +vercel project inspect [project-id] |
| 147 | + |
| 148 | +# Test deployment locally |
| 149 | +vercel --debug |
| 150 | +``` |
| 151 | + |
| 152 | +## Current Status |
| 153 | + |
| 154 | +The CI workflow has been updated to: |
| 155 | + |
| 156 | +- ✅ Continue on Vercel deployment errors |
| 157 | +- ✅ Still deploy to GitHub Pages even if Vercel fails |
| 158 | +- ✅ Provide clear status messages |
| 159 | +- ✅ Not block the entire pipeline |
| 160 | + |
| 161 | +This ensures your API documentation is always deployed to GitHub Pages, even if Vercel deployment has issues. |
0 commit comments