The error Cannot use 'import.meta' outside a module happens because import.meta only works in ES modules, not in the browser console directly.
Your code already logs the API configuration when the page loads! Just look for it:
- Open your Vercel site
- Open Console (F12 → Console tab)
- Refresh the page (F5)
- Look for this message at the top of the console:
🔧 API Configuration: { VITE_API_URL: "https://proteinarchitect-backend.onrender.com", API_URL: "https://proteinarchitect-backend.onrender.com", environment: "production", isProduction: true }
✅ Good (Env var is set):
🔧 API Configuration: {
VITE_API_URL: "https://proteinarchitect-backend.onrender.com",
API_URL: "https://proteinarchitect-backend.onrender.com",
...
}
❌ Bad (Env var NOT set):
🔧 API Configuration: {
VITE_API_URL: "NOT SET",
API_URL: "http://localhost:8000",
...
}
This is the easiest way to see what's happening:
- Open your Vercel site
- Open Developer Tools (F12)
- Click "Network" tab
- Try using a feature (search, research, etc.)
- Look at the requests:
- ✅ Good: Requests go to
proteinarchitect-backend.onrender.com - ❌ Bad: Requests go to
localhost:8000(and fail)
- ✅ Good: Requests go to
✅ Good:
Request URL: https://proteinarchitect-backend.onrender.com/health
Status: 200 OK
❌ Bad:
Request URL: http://localhost:8000/health
Status: (failed) net::ERR_CONNECTION_REFUSED
If you want to check it in the console, we can expose it. But you don't need to - just use Solution 1 or 2!
- Open your Vercel site
- Press
F12 - Click Console tab
- Press
F5to refresh - Look at the top of the console output
- Find the
🔧 API Configuration:message
- If
VITE_API_URLshows the Render URL → ✅ Working! - If
VITE_API_URLshows "NOT SET" → ❌ Not set, need to fix
- Open Network tab (instead of Console)
- Try using a feature
- Look at the request URLs
- See where they're going
When your page loads, the api.js file automatically logs:
console.log('🔧 API Configuration:', {
VITE_API_URL: import.meta.env.VITE_API_URL || 'NOT SET',
API_URL: API_URL,
environment: import.meta.env.MODE,
isProduction: import.meta.env.PROD
});This happens automatically - you don't need to run any commands!
- Click the clear button (🚫) in the console
- Refresh the page (F5)
- Look for the
🔧 API Configuration:message
- In the console, look for a filter/search box
- Type:
API Configuration - This will show only that message
- Go to Network tab
- Try using a feature
- See what URLs are being requested
You don't need to run any commands! Just:
- Open Console (F12)
- Refresh page (F5)
- Look for
🔧 API Configuration:message - Check if
VITE_API_URLshows the Render URL or "NOT SET"
OR
- Open Network tab (F12 → Network)
- Try using a feature
- Check if requests go to Render backend or localhost
After checking:
- If it shows the Render URL: ✅ Working! The error might be something else
- If it shows "NOT SET": ❌ Need to set env var and redeploy
- If requests go to localhost: ❌ Need to set env var and redeploy
What do you see when you refresh the page and check the console?