I keep getting 'DataCloneError: Failed to execute ...
# support
s
Hey there, I made a simple test , on Vue , giving my 'assistantId' to the method 'start' on the Web SDK Whatever I do I keep getting this message , over and over, I can't get over it, its the SDK that returns that
Copy code
vapi.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 : )
Copy code
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&
v
Hey there! 👋 Sorry to hear you're running into this frustrating error. I can't see exactly what's being passed to your
start
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:
Copy code
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 values
5. **Alternative approach**: As suggested in [this Discord thread](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1341910696182681613), consider structuring your data differently to avoid potential cloning issues. Is there anything specific you're passing to the
start
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)
s
thanks a lot for your answer! this is what I'm giving to start const assistant_id = 'b18f2895-495c-4eec-bcab-55e7cf52c1d6' litterally just the const, so i'm not supposed to put the .value as I've seen in the type script interface that it is either a string assistant id or an object assistant that we shall give
k
We look into it and get back to you thanks
Please write down the steps to reproduce this and what you have done until now to resolve this so that I can understand the problem you're facing X and Y number of steps to resolve it. So I can easily figure solution Z which is either an improvisation on Y number of steps or it's a completely new from Y step thanks
s
absolutely, hoping I understand well your request : 1. I created an assistant on https://dashboard.vapi.ai/assistants/ 2. Made sure I get a configuration (model, trasncriber, voice) that works, which is the case with my assistant .. then I copied the assistant id to test it 3. since I was facing the problem on a code that was becoming really complex, I decided to do a clean fresh test 4. I removed from my bun the vapi web sdk 5. I reinstalled it with bun install @Vapi-ai/web I then created a new vue file , on my Nuxt app . I just made it the most simple possible , to test the web sdk, code below code here : https://pastebin.com/AVLFYtpv I confirm getting the same error with the most simple implementation I did that's about it that is all I did https://cdn.discordapp.com/attachments/1361269676075647047/1361344487317700800/CleanShot_2025-04-14_at_16.12.462x.png?ex=67fe6a5a&is=67fd18da&hm=e6a1cfa95b9361cf9f06294b43161644e59f81c4374cc58663c925ca68f8dcb1& https://cdn.discordapp.com/attachments/1361269676075647047/1361344487779078385/carbon_2.png?ex=67fe6a5a&is=67fd18da&hm=cf327bd87bb347852af6905f93b232a2049b675e0d3d61720e75f315b4fae1c7& https://cdn.discordapp.com/attachments/1361269676075647047/1361344488223805570/CleanShot_2025-04-14_at_16.15.302x.png?ex=67fe6a5a&is=67fd18da&hm=9ca9af0bafed3517da86cbf832abbbc75e067414a217f63d67357acd398e8d63&
s
Can you share the network tab logs?
we can see my api key but its the public one so okay I guess
s
@Shubham Bajaj can you help?