Call id af9a291d-3568-4892-9ddd-ef979899ef19
# support
s
My tool call is being called however I get a 500 server error. When I look at the webhook logs and I copy and paste the request into the tool test it works. Plz help is a critical functionality
v
Hi there! 👋 I see you're experiencing a 500 server error with your tool call in Vapi. I don't have access to your specific logs for call ID af9a291d-3568-4892-9ddd-ef979899ef19, but I can definitely help you understand why your tool call might be working in the test environment but failing in production. Based on the information I found, here are some common causes for this issue: ## Response Format Issues One of the most common causes is incorrect response formatting. When Vapi makes a tool call: - The JSON response must be correctly formatted with the proper
toolCallId
and
result
fields - The
toolCallId
in your response must match the one sent by Vapi in the initial request - The
result
must be a single-line string without any line breaks According to [documentation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1325000684231196775), mismatched
toolCallId
values are a frequent cause of errors. ## Environment Differences There are several differences between the test and production environments that could explain this behavior: - **Tool Configuration**: The tool might be set to
async
mode in production but
synchronous
in the test environment - **Network Accessibility**: Your server might be accessible in the test environment but not properly configured for production requests - **Request Handling**: Production environments often have different rate limits, timeouts, or concurrency settings ## Debugging Steps 1. **Check Webhook Logs**: Review the logs for details about the failed request, including: - The exact error message - The request payload - The response (or lack thereof) 2. **Compare Request Details**: Since you mentioned the request works when copied to the tool test, compare: - Headers - Authentication - Request body format - Response timing 3. **Server Logs**: Check your server logs for any errors that might be occurring when Vapi makes the request in production
4. **Response Format**: Ensure your server is returning a properly formatted response with: - Correct
toolCallId
matching the one sent by Vapi -
result
as a properly formatted string (no line breaks) - Proper JSON structure Is there anything specific in the webhook logs that you'd like me to help interpret, or would you like more detailed information about any of these debugging steps? Sources: - [Discord Thread about Tool Call Errors](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1325000684231196775) - [Discord Thread about Debugging 500 Errors](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1328923059905630238) - [Discord Thread about Environment Differences](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1342315282198298729)
s
Is there somewhere I can change the timeout settings of tool calls or see if that would be the problem
Is there somewhere else I can look for things that would be different in test tools vs production. Do I have to protect my APIs with a API key?
s
checking if this is resolved/solved for you?
2 Views