Deploy to Vercel
While the template uses Netlify by default, you can easily deploy to Vercel by following this guide.
Prerequisites
- A Vercel account
- Your project in a Git repository
- Node.js 18 or higher
Configuration Changes
1. Switch to Vercel Adapter
First, install the Vercel adapter:
2. Update Configuration
Modify your astro.config.mjs
:
3. Commit Changes
Deployment Steps
1. Import Your Project
- Go to Vercel Dashboard
- Click “Import Project”
- Select your Git repository
- Vercel will auto-detect Astro configuration
2. Configure Project
In the Vercel dashboard:
- Keep the auto-detected build settings
- Add environment variables:
- Click “Deploy”
Custom Domain Setup
- Go to Project Settings → Domains
- Click “Add Domain”
- Follow Vercel’s domain configuration steps
Deployment Features
Vercel provides:
- Automatic HTTPS
- Preview deployments
- Edge functions support
- Analytics
- Performance monitoring
Troubleshooting
Common Issues
-
Build Failures
- Check Node.js version compatibility
- Verify all dependencies are installed
- Review build logs
-
Runtime Errors
- Confirm environment variables are set
- Check Sanity connection
- Verify SSR configuration
-
Performance Issues
- Enable Vercel’s edge caching
- Optimize image loading
- Review Vercel Analytics
-
Invalid Runtime Error If you encounter the error: “The following Serverless Functions contain an invalid ‘runtime’: - _render (nodejs18.x)”, follow these steps:
- Click on “Go to Project”
- Navigate to Settings
- Look for the Node.js Version setting
- Set it to Node.js 18.x
- Click on save
- Go back to Deployments
- Click on Redeploy
Need Help?
- Check Vercel’s Documentation
- Review Astro’s Vercel Guide
- Join our Telegram support group here.