Closed rafaelvmedeiros closed 1 year ago
same here:
Cannot read properties of undefined (reading 'destroy')
TypeError: Cannot read properties of undefined (reading 'destroy')
at encryptedStream (/.../node_modules/@adiwajshing/baileys/lib/Utils/messages-media.js:346:16)
at async prepareWAMessageMedia (/.../node_modules/@adiwajshing/baileys/lib/Utils/messages.js:101:109)
at async generateWAMessageContent (/.../node_modules/@adiwajshing/baileys/lib/Utils/messages.js:327:13)
at async generateWAMessage (/.../node_modules/@adiwajshing/baileys/lib/Utils/messages.js:472:59)
at async Object.sendMessage (/.../node_modules/@adiwajshing/baileys/lib/Socket/messages-send.js:606:33)
WhatsApp service isn't working properly today for file uploads, nothing to do with Baileys. Relax
WhatsApp service isn't working properly today for file uploads, nothing to do with Baileys. Relax
I've been having this problem for three days already. So.. this is from whatsapp service?
Not sure though If you send an image using a Readable stream instead of an URL, it works so you can indeed upload an image to whatsapp if you pass a Readable stream to Baileys instead of a url
Not sure though If you send an image using a Readable stream instead of an URL, it works so you can indeed upload an image to whatsapp if you pass a Readable stream to Baileys instead of a url
I'm not using URL. I´m using buffer.
options = {
image: fs.readFileSync(`${publicFolder}/${media.filename}`),
caption: body,
};
I´m seeing in the interface I´ll try use Redable instead Buffer.
not saying this is good or the way to go.. i do think sending a URL is so much better just saying that this may not be due to whatsapp being down today
not saying this is good or the way to go.. i do think sending a URL is so much better just saying that this may not be due to whatsapp being down today
I'll try. But i think it´s a problem in url media from what´s service. Because the error is about 'certificate'.
I've changed the axios parameters to ignore invalid certificate, but it not works. I'm getting this error in my environment (local) and production machine.
messages-media.js
When Baileys try to send media data and get any error.. it try to request using another links, but anyone are works.
I generated a link using what'sapp web If i try it in browser works well. https://media.fgig22-1.fna.whatsapp.net/mms/image/9vQ9LJcArnC56c9X_1qTk6dRY5GGrJKotol5DgTUleQ=?auth=Ac0IB0T44fwyM-c1EK6cQpFqP50Kkxu7qguzQyeQk0gv3Q&token=9vQ9LJcArnC56c9X_1qTk6dRY5GGrJKotol5DgTUleQ%3D&resume=1&media_id=579306653185760
I've setted this link in code, But i got the same error.
Anyone knows why i'm getting this error? Should i running node with https directly? Should i make the request directly in frontend?
I'm trying to ignore it in the code, but without success.
I fix that. If anyone has this issue. I solved this way:
I downloaded the whatsapp crt file from whatsapp web.
const certsPath = resolve(__dirname, "..", "..", "certs");
const cert = readFileSync(${certsPath}/whatsapp.crt
);
and i loaded it there:
Now all is working fine.
hi everyone. does anyone getting this error? I'm using "@whiskeysockets/baileys": "^6.2.1" and i'm getting error when i try to send a image only.
sharecontacts and text works fine. but when i try to send an image, i got this error.
const sentMessage = await wbot.sendMessage("12345@s.whatsapp.net", { image: fs.readFileSync('C:\Projects\backend\public\img-2.jpg', caption: "img-2.jpg" } );
{ data: null, isBoom: true, isServer: true, output: { statusCode: 500, payload: { statusCode: 500, error: "Internal Server Error", message: "An internal server error occurred", }, headers: { }, },
Stack Error
'Media upload failed on all hosts'
'Error: Media upload failed on all hosts\n at Object.upload (C:\Projects\optinchat-old\backend\node_modules\@whiskeysockets\baileys\lib\Utils\messages-media.js:539:19)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n at C:\Projects\optinchat-old\backend\node_modules\@whiskeysockets\baileys\lib\Utils\messages.js:110:28\n at async Promise.all (index 0)\n at prepareWAMessageMedia (C:\Projects\optinchat-old\backend\node_modules\@whiskeysockets\….js:472:59)\n at Object.sendMessage (C:\Projects\optinchat-old\backend\node_modules\@whiskeysockets\baileys\lib\Socket\messages-send.js:606:33)\n at SendWhatsAppMedia (C:\Projects\optinchat-old\backend\src\services\WbotServices\SendWhatsAppMedia.ts:173:25)\n at C:\Projects\optinchat-old\backend\src\controllers\MessageController.ts:86:11\n at async Promise.all (index 0)\n at store (C:\Projects\optinchat-old\backend\src\controllers\MessageController.ts:84:7)'