🛑 Help Needed: Vapi AI Webhook Network Error (Pos...
# support
v
Hey everyone, I'm hitting a wall with a peculiar network error while integrating Vapi AI with my Next.js app. Hoping some of you brilliant minds might have insights! The Setup: Vapi AI Assistant with a custom "Tool" to fetch user holdings. Next.js API route (/api/kite-holdings) that calls the Kite Connect API. Ngrok is used to expose my local Next.js server to the internet for the Vapi webhook. The Problem: When I use Postman (or curl) to send a POST request to my Ngrok URL (https://[my-ngrok-url]/api/kite-holdings), it works perfectly fine and returns a 200 OK with the expected data from Kite Connect. This tells me my Next.js API route, the Kite Connect integration, and the Ngrok tunnel itself are all functioning correctly. However, when I go to the Vapi AI dashboard and test the tool, I consistently get a "Network error: Unable to connect to the server." https://cdn.discordapp.com/attachments/1378089542598529114/1378089542900514909/image.png?ex=683b5566&is=683a03e6&hm=c08eb365a93a8febb596cfa7db09a3d3da5e5c406c31b4d1e6b651f9e6018785& https://cdn.discordapp.com/attachments/1378089542598529114/1378089543185596606/GsOEExvWEAAppWU.png?ex=683b5566&is=683a03e6&hm=513423d19e61c2f860b70d1f4ee5cf7fe22818d24607fcb19430a7ccbede1dac&
Steps I've Already Taken: Confirmed Ngrok is actively running and forwarding traffic on port 3000. Verified my Next.js development server is running on localhost:3000. Ensured the HTTPS Ngrok URL in Vapi's tool configuration is updated and exactly matches the current Ngrok forwarding URL (restarting Ngrok gives a new URL, and I update Vapi immediately). Checked my Next.js terminal for any errors when Vapi attempts a connection (nothing shows up, indicating the request isn't even reaching my app). The Vapi tool configuration JSON itself seems correct: JSON -> { "id": "...", "type": "function", "function": { "name": "getholdings", "description": "can you get my current holding", "parameters": { "type": "object", "properties": {}, "required": [] } }, "server": { "url": "https://5599-2401-4900-55b3-6a09-c153-c8a3-4429-621e.ngrok-free.app/api/kite-holdings", // (Placeholder URL) "headers": {} }, "async": true } It's baffling that Postman can connect but Vapi can't. Has anyone encountered this specific scenario before where a webhook works externally but not from Vapi's internal testing? Could it be a subtle Ngrok free-tier limitation, Vapi's specific server IPs, or something I'm overlooking? Any ideas or debugging tips would be hugely appreciated! Thanks in advance! 🙏
s
It looks like this is related to CORS policy, which you can't bypass with Make. If you call it directly, it should work.
r
I am facing the exact issue, and I was under the impression that ngrok is doing something funky and Vapi is not able to call the webhook. But then I deployed the API on vercel and Vapi just cant send the test message to the hook. I see the same error message as @Vishal.k , and I am able to call the endpoint successfully from Postman.
Looks like there is something broken in the Tool test, it throws same error even while trying a generic placeholder webhook service like this https://webhook.site/#!/view/54ce2170-106a-4594-8482-6f0800710474
s
Hey Vishal, since we use multiple services/servers, the test tool sends a request to one server and receives the response from another. so it's an issue on our end. Rest assured, your tools are safe to test and use.
3 Views