`x-vapi-secret` header empty during tool call.
# support
l
I am experiencing an issue where the
x-vapi-secret
header is set for a tool but in my logs I see that the header is left empty when the tool call reaches my server. The affected tool is d72b998c-9940-47a2-9cc5-70275db41e9d. I have set the x-vapi-secret for this tool using your API (there must be a bug in your UI that prevents this field to be set in your dashboard). I can confirm with a GET request that the header is set: https://api.vapi.ai/tool/d72b998c-9940-47a2-9cc5-70275db41e9d The tool is attached to assistant
6fe23f53-13b0-48d8-8e9e-c8d6fb8a3f56
. I tested it out and the header is passed empty. From our server logs I can see the header being empty: INFO:app.routers.tools:Headers: Headers({'x-forwarded-for': 'OMITTED', 'x-forwarded-proto': 'https', 'x-forwarded-port': '443', 'host': 'OMITTED', 'x-amzn-trace-id': 'Root=1-67c75fb1-3dd07e94526fd4a459652d65', 'content-length': '21263', 'accept': 'application/json, text/plain, */*', 'content-type': 'application/json', 'x-vapi-secret': '', 'cookie': 'callId=76781975-853a-41db-a7f7-bb88ff443724', 'user-agent': 'axios/1.7.7', 'accept-encoding': 'gzip, compress, deflate, br', 'sentry-trace': 'c5792ec3ca0047598b2937a5b3578c50-94c7709781947d54', 'baggage': 'sentry-environment=production,sentry-public_key=a0021577936aec367b16615ad816c078,sentry-trace_id=c5792ec3ca0047598b2937a5b3578c50', 'x-datadog-trace-id': '4051100257980689848', 'x-datadog-parent-id': '4051100257980689848', 'x-datadog-sampling-priority': '0', 'x-datadog-tags': '_dd.p.tid=67c75fb000000000', 'traceparent': '00-67c75fb00000000038386638926eadb8-38386638926eadb8-00', 'tracestate': 'dd=t.tid:67c75fb000000000;t.dm:-1;s:0;p:38386638926eadb8'}) Can you help me understand why? Looking forward to hearing back from you. Lucio
v
Hi Lucio! 😊 I understand you're having trouble with the
x-vapi-secret
header being empty when the tool call reaches your server, even though you've set it correctly via the API. This can be frustrating! Here are a few common issues that might be causing this: 1. **UI and API Inconsistencies**: There are known bugs in the Vapi UI that can prevent the
x-vapi-secret
from being saved properly. Even if the API confirms that the header is set, it might not persist correctly due to these UI issues. 2. **Header Not Persisting**: Sometimes, headers like
x-vapi-secret
do not persist after saving configurations. This can lead to them appearing empty in the logs when the tool is called. 3. **Configuration Issues**: Ensure that the configuration for the tool is being saved correctly. You might want to double-check the API response after setting the header to confirm it’s being stored as expected. 4. **Using the API for Configuration**: Since the UI has known issues, it's often recommended to configure headers directly via the API. You can use a
PATCH
request to ensure the header is set correctly. Here’s an example of how to do that:
Copy code
bash
   curl -X PATCH https://api.vapi.ai/tool/d72b998c-9940-47a2-9cc5-70275db41e9d \
   -H "Authorization: Bearer your_api_key" \
   -H "Content-Type: application/json" \
   -d '{
       "server": {
           "url": "your_webhook_url",
           "headers": {
               "x-vapi-secret": "your_secret_key"
           }
       }
   }'
5. **Network and Browser Issues**: Sometimes, network configurations or browser settings can affect how headers are sent. Testing in an incognito window or a different browser might help. If the issue persists, I recommend reaching out to Vapi support with detailed logs and the steps you've taken. They can provide more specific assistance. Let me know if you need any more help! 👍 Sources:
s
Hey! To help track down this issue, could you share: - The call ID This would really help us figure out what went wrong!
s
@Lucio check your DMs for log file which will help you understand how we are sending the secret to your server