lordgpt
10/17/2024, 4:19 PMconst Vapi = require("@vapi-ai/web").default;
// Replace with your actual Vapi public key
const vapi = new Vapi("public-key");
// Starting a call with an assistant ID
vapi.start("assistant id");
---here is the error---
ReferenceError: window is not defined
at new re (/Users/nischalj10/Documents/Codebases/vapi-demo/node_modules/@daily-co/daily-js/dist/daily.js:1:114444)
at Function.value (/Users/nischalj10/Documents/Codebases/vapi-demo/node_modules/@daily-co/daily-js/dist/daily.js:1:188113)
at Vapi.start (/Users/nischalj10/Documents/Codebases/vapi-demo/node_modules/@vapi-ai/web/dist/vapi.js:98:44)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^
Vapi
10/17/2024, 4:22 PMReferenceError: window is not defined
indicates that the code is trying to access the window
object, which is only available in web browsers.
To resolve this issue, you should ensure that you're running your Vapi code in a context where the window
object is available, such as within a web page's script tag or a front-end JavaScript file that is bundled for browser use.
If you're trying to use Vapi in a server-side context with Node.js, you'll need to check if Vapi provides a Node.js compatible package or an alternative way to interact with their API from the server side.
If you need further assistance with this issue or if there's anything else I can help you with, please let me know!Vapi
10/17/2024, 4:22 PMlordgpt
10/17/2024, 4:25 PMShubham Bajaj
10/18/2024, 11:16 AMlordgpt
10/18/2024, 11:34 AMlordgpt
10/18/2024, 11:34 AMShubham Bajaj
10/18/2024, 12:30 PM