-
Notifications
You must be signed in to change notification settings - Fork 28
Description
App.jsx:11 Uncaught TypeError: Vapi is not a constructor
at App (App.jsx:11:14)
I am using vapi's latest version i.e 2.5.1. i am not being able to fix the issue. Whenever i write const vapi= new Vapi(public_api) i get this error 'vapi aint a constructor' and when i do const vapi=Vapi(public_api) i get this error 'vapi aint a function'
I am using vapi 2.5.1 version . All I want is to make a start call button int the ui and whenever i click on that i wanna talk to vapi ai. And with transcripts i wanna update dahsboard, generate call summaries, etc etc. I tried reinstalling package, downloading client-sdk but nothing worked. Here is my code anyone please fix it
import * as Vapi from "@vapi-ai/web"
import React from "react"
const VITE_VAPI_FRONTEND=import.meta.env.VITE_VAPI_FRONTEND
const VITE_VAPI_ASSISTANT=import.meta.env.VITE_VAPI_ASSISTANT
const WORKFLOW_ID=import.meta.env.VITE_WORKFLOW_ID
function App(){
const vap= new Vapi(VITE_VAPI_FRONTEND)
vap.start(VITE_VAPI_ASSISTANT)
vap.on('call-start',()=>console.log('Call has started'))
return (<>
Vapi 2.0
Start Stop ) }export default App;