Sparkls
04/14/2025, 9:19 AMvapi.vue:68 DataCloneError: Failed to execute 'postMessage' on 'Window': #<Object> could not be cloned.
at Proxy.value (@vapi-ai_web.js?v=ce72b799:4346:18)
at Proxy.value (@vapi-ai_web.js?v=ce72b799:5886:30)
at Proxy.<anonymous> (@vapi-ai_web.js?v=ce72b799:5310:732)
at Generator.next (<anonymous>)
at p (@vapi-ai_web.js?v=ce72b799:180:20)
at a2 (@vapi-ai_web.js?v=ce72b799:192:9)
await in start
start_call @ vapi.vue:68
handle_click @ Button_.vue:164
my code is (or at least the logic part is : )
const VAPI_PUBLIC_API_KEY = get_runtime_config()?.public?.VAPI_PUBLIC_API_KEY
//================== FUNCTIONS ==================
const init_vapi = () => {
if (!VAPI_PUBLIC_API_KEY) return new Error_({ data: 'VAPI_PUBLIC_API_KEY not found' })
vapi.value = new Vapi(VAPI_PUBLIC_API_KEY)
setup_listeners()
return new Success_({ data: 'VAPI initialized' })
}
const setup_listeners = () => {
if (!vapi.value) return
vapi.value.on('call-start', () => {
connecting.value = false
connected.value = true
})
vapi.value.on('call-end', () => {
connecting.value = false
connected.value = false
})
vapi.value.on('speech-start', () => {
assistant_is_speaking.value = true
})
vapi.value.on('speech-end', () => {
assistant_is_speaking.value = false
})
vapi.value.on('volume-level', (level) => {
volume_level.value = level
})
vapi.value.on('error', (error) => {
debug.error('VAPI error:', error)
connecting.value = false
})
}
......... (rest of the code on image)
}
anyone knows? I'm currenty blocked there fore some time sadly
https://cdn.discordapp.com/attachments/1361269676075647047/1361269676604133416/CleanShot_2025-04-14_at_11.15.242x.png?ex=67fe24ae&is=67fcd32e&hm=66b77259c99e8ecb51c251a19985b91fc8779b5eb1f6b09a40363788ced3dc0d&
https://cdn.discordapp.com/attachments/1361269676075647047/1361269677459898489/carbon_1.png?ex=67fe24ae&is=67fcd32e&hm=e1f781710c6fe32b5833b026521910b158df42be60f4007cea9eb12cca00b2c7&Vapi Support Bot
04/14/2025, 9:21 AMstart
method, but I can definitely help explain what's happening with the DataCloneError and suggest some solutions.
The DataCloneError
occurs when the postMessage
method tries to clone an object that contains non-cloneable data types. This happens because the Vapi Web SDK uses postMessage
internally for communication.
Here are some troubleshooting steps you can try:
1. **Check what you're passing to the start method**: Make sure you're only passing serializable data. According to the [best practices for using postMessage](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1341910696182681613), you should avoid passing complex objects that might contain functions, DOM nodes, or circular references.
2. **Simplify your start call**: Try using just the assistantId without any additional configuration:
javascript
const start_call = async () => {
try {
connecting.value = true
call.value = await vapi.value.start(assistant_id.value)
} catch (error) {
console.error('Error starting call:', error)
connecting.value = false
}
}
3. **Check SDK version compatibility**: According to [Discord discussions](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1239945056937443510), version compatibility can sometimes cause issues. Make sure you're using the latest version of the Vapi Web SDK.
4. **Examine your data structure**: If you're passing configuration options to the start
method, try to identify any non-serializable objects in your data structure. Common culprits include:
- Functions or methods
- DOM elements
- Objects with circular references
- Error objects
- Symbol valuesVapi Support Bot
04/14/2025, 9:21 AMstart
method beyond just the assistantId? That might help pinpoint the exact cause of the error.
Sources:
- [Discord thread about data handling](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1341910696182681613)
- [Discord thread about SDK version compatibility](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1239945056937443510)Sparkls
04/14/2025, 10:37 AMKings_big💫
04/14/2025, 10:43 AMKings_big💫
04/14/2025, 1:19 PMSparkls
04/14/2025, 2:17 PMSparkls
04/14/2025, 2:20 PMSahil
04/17/2025, 2:44 PMSparkls
04/19/2025, 11:01 AMSparkls
04/19/2025, 11:01 AMSahil
04/22/2025, 10:54 AM