I get the error as shown in the image when trying to send a video (.mov file, 6 MB), using the below code and config, I am able to send image successfully but not a video:
Client Started with this config:
static getHeadlessClient() {
console.log("Provided headless argument.")
return new Client(
{
authStrategy: new LocalAuth(
{
clientId: "self",
dataPath: "/data",
}
),
puppeteer: {
executablePath: '/usr/bin/google-chrome-stable',
args: ['--no-sandbox', '--disable-setuid-sandbox'], ignoreDefaultArgs: ['--disable-dev-shm-usage'], ignoreHTTPSErrors: true
}
}
);
}
Code to send message:
async function sendBonfire(name, phoneNumber) {
try {
// Create a MessageMedia instance from the URL
const media = await MessageMedia.fromFilePath('./img/bonfire.mov');
// Send the video to the specified number
client.sendMessage(`${phoneNumber}@c.us`, media, { caption: `Hello ${name} ji, dont forget to ask for Bonfire at dinner for an unforgettable experience.` });
} catch (error) {
console.error('Error sending video:', error);
}
}