The CORS and 404 errors you're seeing require a server-side proxy to access the ElevenLabs API. Here's how to set it up:
Open a terminal in the C:\Personal\Chronicles directory and run:
# Navigate to server directory
cd server
# Install dependencies
npm install# Start the proxy server
npm startThe server will start on http://localhost:3001 and show:
🚀 Chronicles Proxy Server running on http://localhost:3001
📡 Health check: http://localhost:3001/health
🔧 Test APIs: http://localhost:3001/api/test
Open your browser and go to:
http://localhost:3001/health- Should show server statushttp://localhost:3001/api/test- Should show API connectivity
-
Make sure both servers are running:
- Main app:
http://localhost:5173(or your Vite dev server) - Proxy server:
http://localhost:3001
- Main app:
-
Go to
/conversation-syncin your app -
Use the "WebSocket Bypass" section:
- Click "🔧 Test Proxy Server" first
- Then "👥 List Available Agents" to find your correct agent ID
- Finally "🚀 Try Direct Fetch" to sync conversations
If you prefer to set up manually:
# Create server directory if it doesn't exist
mkdir -p server
# Navigate to server directory
cd server
# Create package.json
npm init -y
# Install required dependencies
npm install express cors dotenv node-fetch@2
# Install development dependencies
npm install --save-dev nodemon
# Start the server
node proxy-server.jsSolution: The proxy server isn't running. Run npm start in the server directory.
Solution: Check that your .env file has the correct VITE_ELEVEN_LABS_API_KEY.
Solution: Your agent ID might be incorrect. Use "👥 List Available Agents" to find the right one.
Solution: Either stop the other process or change the port:
PROXY_PORT=3002 npm start- CORS Issue: Browsers block direct calls to ElevenLabs API due to CORS policy
- Our Solution: Node.js proxy server acts as a middleman
- Flow: Browser → Proxy Server → ElevenLabs API → Proxy Server → Browser
- Result: No CORS issues, and we can properly handle API responses
For production, you'd want to:
- Deploy the proxy server to a cloud service (Heroku, Railway, etc.)
- Update
VITE_PROXY_SERVER_URLin your.envto point to the deployed server - Secure the proxy with authentication if needed
- 🔧 Test Proxy Server: Checks if proxy is running and APIs are accessible
- 👥 List Available Agents: Shows all your ElevenLabs agents with their IDs
- 🚀 Try Direct Fetch: Syncs conversations using the proxy server
- 📡 Try XMLHttpRequest: Alternative method if fetch fails
- ✏️ Manual Input: Fallback for pasting JSON data directly
After setup, your conversations will sync successfully from ElevenLabs to Supabase! 🎉