Function calls not working
# support
p
My function call is not being called properly. When I run the test in setup it shows as an OPTIONS call in my logs, not as a POST call. When I run the assistant and ask it to call the function, there are no logs on the server and the logs show that Vapi is throwing the error: pipeline-error-azure-openai-llm-failed (see ID 566519ab-097c-4eb1-b587-609467a10b9f) So close to a working product but this error is driving me crazy. Any ideas? **SOLVED**: Remember to add "x-vapi-secret" to the "Access-Control-Allow-Headers" header where handling CORS pre-flight. See the thread below for sample code. https://cdn.discordapp.com/attachments/1239698235300253768/1239698235564490762/image.png?ex=66448733&is=664335b3&hm=101e447438d3391a6aed6021b9903e85a0723f8f3368d7217b41d7d17185ff8e& https://cdn.discordapp.com/attachments/1239698235300253768/1239698235828863016/image.png?ex=66448733&is=664335b3&hm=ff88b0c14d5849259fe81756c31d04f97b815a3c6fc4dde3658674870d9b5102&
v
Hi @Prince, I'm an AI assistant for Vapi. I'll analyze available sources and get back to you shortly.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [List Calls]() * [Call Ended Reason]() * [Create Phone Call]() * [Get Call]() -----------------------------
### Answer The error you are encountering,
pipeline-error-azure-openai-llm-failed
, indicates a failure within the Azure OpenAI LLM pipeline. This is a known issue that has been discussed in community forums and may be related to specific function call configurations [(1)]() . Here are a few steps you can take: 1. **Check Your Function Configuration**: Ensure that the function schema is correctly defined. A common issue is having an invalid schema for a function, which can lead to this error. For example:
Copy code
json
   {
       "name": "sendEmail",
       "description": "Used to send an email to a client.",
       "parameters": {
           "type": "object",
           "properties": {
               "emailAddress": { "type": "string" }
           },
           "required": ["emailAddress"]
       }
   }
2. **Test OpenAI Endpoint Directly**: You can try sending a direct request to the OpenAI endpoint to ensure that your function configuration and the OpenAI integration are working correctly. This can help isolate whether the issue is within Vapi or the OpenAI integration. 3. **Monitor Server Logs**: Ensure that your server is set up to handle POST requests appropriately. The OPTIONS call is a preflight request used in Cross-Origin Resource Sharing (CORS) to check permissions before making the actual POST request. If these are not handled correctly, the function call may fail. 4. **Check Vapi Status**: Occasionally, the problem may be on Vapi's end due to integration issues or service outages. Monitoring Vapi's status page or reaching out on their forums might provide insights. If these steps do not resolve the issue, it may be best to keep an eye on community forums for updates or potential bug fixes related to this error, [(2)]() , [(3)]() .
p
I'm handling this OPTIONS request now but it's still failing on the dashboard side and won't send a POST request. Any ideas? https://cdn.discordapp.com/attachments/1239698235300253768/1239905475227684915/image.png?ex=66449f75&is=66434df5&hm=f58792a5a81e5d7a9f22463856507d5c123ded2d8eb53c8873446c0b7c6c8f4a&
s
Just allow origin as * then give it a try
and then see if it is fault from vapi or your side
shouldn't it be sending a POST now that the headers are assigned? It keeps sending OPTIONS, seems odd
not sure why this was prematurely marked solved but I've figured it out, for those checking back here you need to add "x-vapi-secret" to the "Access-Control-Allow-Headers" header where handling CORS pre-flight.