painful-plum
painful-plum3h ago

Network Error on API Request Tool

Network error: Unable to connect to the server. This could be due to CORS restrictions, the server being down, or network connectivity issues. Request Details: Method: GET URL: Nextjs App deployed on vercel Header: Using Deployment protection bypass secret But on executing the same request on postman, responds successfully.
No description
1 Reply
Vapi
Vapi3h ago
Try adding CORS headers to your Next.js API route to resolve the network error.
For example, in your API handler, add:
export default function handler(req, res) {
res.setHeader('Access-Control-Allow-Origin', '*');
// ...your existing logic
res.status(200).json({ message: 'Thank You' });
}
export default function handler(req, res) {
res.setHeader('Access-Control-Allow-Origin', '*');
// ...your existing logic
res.status(200).json({ message: 'Thank You' });
}
This allows cross-origin requests and should fix CORS-related network errors when called from the API Request Tool. Source: - Server URLs Vapi Documentation
⤵️ Mention @Vapi Support Bot for follow-ups 🐥

Did you find this page helpful?