Skip to content

VAPI IS NOT A CONSTRUCTOR ERROR #149

@atharva-64

Description

@atharva-64

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions