i am getting error when i try to upload video to user when user send Command
Evaluation failed: a
at ExecutionContext._ExecutionContext_evaluate (C:\Users\inira\OneDrive\Documents\BotWa\node_modules\whatsapp-web.js\node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:229:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ExecutionContext.evaluate (C:\Users\inira\OneDrive\Documents\BotWa\node_modules\whatsapp-web.js\node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:107:16)
at async Client.sendMessage (C:\Users\inira\OneDrive\Documents\BotWa\node_modules\whatsapp-web.js\src\Client.js:947:28)
at async WhatsAppBot.handleVideo (file:///C:/Users/inira/OneDrive/Documents/BotWa/index.js:504:9)
at async handleFeature (file:///C:/Users/inira/OneDrive/Documents/BotWa/index.js:111:9)
at async WhatsAppBot.handleCommonFeatures (file:///C:/Users/inira/OneDrive/Documents/BotWa/index.js:124:5)
at async Client. (file:///C:/Users/inira/OneDrive/Documents/BotWa/index.js:69:7)
and I've done the replacement
this.client = new Client({
authStrategy: new LocalAuth(), // Your authstrategy here
puppeteer: {
headless: true,
args: ["--no-sandbox", "--disable-setuid-sandbox"],
executablePath: "C:\Program Files\Google\Chrome\Application\chrome.exe", // Path ke Google Chrome di Windows
},
webVersionCache: {
type: "remote",
remotePath: https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/${wwebVersion}.html,
},
});
and i use exodus
"whatsapp-web.js": "github:pedroslopez/whatsapp-web.js#webpack-exodus"
Expected behavior
it should be when I upload the video and I've buffered it. The video can be sent to the user who sent the request
try {
// Unduh video dari YouTube
const videoPath = await this.downloadYouTubeVideo(videoQuery);
if (fs.existsSync(videoPath)) {
// Membaca video sebagai buffer
const fileBuffer = fs.readFileSync(videoPath);
const fileExtension = path.extname(videoPath).slice(1); // Mengambil ekstensi file tanpa titik
const fileName = path.basename(videoPath); // Nama file
// Membuat objek MessageMedia dengan buffer
const media = new MessageMedia(
`video/${fileExtension}`, // Mimetype video (misalnya: video/mp4)
fileBuffer.toString("base64"), // Base64 encoded video
fileName // Nama file
);
// Mendapatkan chatId dari pesan
const chatId = message.from; // Use message.from for chat ID
// Mengirim video dengan caption
await this.client.sendMessage(chatId, media, {
caption: "Video telah siap!",
});
// Hapus file setelah dikirim
fs.unlinkSync(videoPath);
await statusMessage.edit("Video berhasil dikirim.");
} else {
await statusMessage.edit("Gagal mengunduh video.");
}
} catch (error) {
console.error("Error saat mengunduh atau mengirim video:", error);
await statusMessage.edit("Gagal mengunduh video.");
}
}
Browser Type
Google Chrome
WhatsApp Account Type
WhatsApp Business
Does your WhatsApp account have multidevice enabled?
No, I am not using Multi Device
Environment
Node.js Version v22.3.0
Npm Version v10.8.2
WhatsApp-Web.js Version v2.30.1
OS Windows
Is there an existing issue for this?
Describe the bug
i am getting error when i try to upload video to user when user send Command
Evaluation failed: a at ExecutionContext._ExecutionContext_evaluate (C:\Users\inira\OneDrive\Documents\BotWa\node_modules\whatsapp-web.js\node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:229:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async ExecutionContext.evaluate (C:\Users\inira\OneDrive\Documents\BotWa\node_modules\whatsapp-web.js\node_modules\puppeteer-core\lib\cjs\puppeteer\common\ExecutionContext.js:107:16) at async Client.sendMessage (C:\Users\inira\OneDrive\Documents\BotWa\node_modules\whatsapp-web.js\src\Client.js:947:28) at async WhatsAppBot.handleVideo (file:///C:/Users/inira/OneDrive/Documents/BotWa/index.js:504:9) at async handleFeature (file:///C:/Users/inira/OneDrive/Documents/BotWa/index.js:111:9) at async WhatsAppBot.handleCommonFeatures (file:///C:/Users/inira/OneDrive/Documents/BotWa/index.js:124:5) (file:///C:/Users/inira/OneDrive/Documents/BotWa/index.js:69:7)
at async Client.
and I've done the replacement
this.client = new Client({ authStrategy: new LocalAuth(), // Your authstrategy here puppeteer: { headless: true, args: ["--no-sandbox", "--disable-setuid-sandbox"], executablePath: "C:\Program Files\Google\Chrome\Application\chrome.exe", // Path ke Google Chrome di Windows }, webVersionCache: { type: "remote", remotePath:
https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/${wwebVersion}.html
, }, });Expected behavior
it should be when I upload the video and I've buffered it. The video can be sent to the user who sent the request
Steps to Reproduce the Bug or Issue
This is my code to handle send video to whatsapp
Relevant Code
async downloadYouTubeVideo(query) { return new Promise((resolve, reject) => { const isYouTubeLink = /^(https?:\/\/)?(www.)?(youtube.com\/|youtu.be\/).+$/i.test(query);
}
async handleVideo(message) { const videoQuery = message.body.replace(/^(video|film)\s*/i, "").trim(); const statusMessage = await message.reply("Sedang mengunduh video...");
}
Browser Type
Google Chrome
WhatsApp Account Type
WhatsApp Business
Does your WhatsApp account have multidevice enabled?
No, I am not using Multi Device
Environment
Node.js Version v22.3.0 Npm Version v10.8.2 WhatsApp-Web.js Version v2.30.1 OS Windows
Additional context
No response