triggerUncaughtException(err, true /* fromPromise */); · Issue #2528 · pedroslopez/whatsapp-web.js

  • 3,000
  • Tác giả: admin
  • Ngày đăng:
  • Lượt xem: 3
  • Tình trạng: Còn hàng

Is there an existing issue for this?

* [x]  I have searched the existing issues

Describe the bug

When i try đồ sộ send videos that downloaded by ytdl-core it shown this error only for some videos but for some videos it downloads and send perfectly

Expected behavior

node:internal/process/promises:288 triggerUncaughtException(err, true /* fromPromise */); ^

u: u at #evaluate (C:\Users\AH\Desktop\zyntex bot\node_modules\puppeteer-core\lib\cjs\puppeteer\cdp\ExecutionContext.js:229:55) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async ExecutionContext.evaluate (C:\Users\AH\Desktop\zyntex bot\node_modules\puppeteer-core\lib\cjs\puppeteer\cdp\ExecutionContext.js:126:16) at async IsolatedWorld.evaluate (C:\Users\AH\Desktop\zyntex bot\node_modules\puppeteer-core\lib\cjs\puppeteer\cdp\IsolatedWorld.js:128:16) at async CdpFrame.evaluate (C:\Users\AH\Desktop\zyntex bot\node_modules\puppeteer-core\lib\cjs\puppeteer\api\Frame.js:370:20) at async CdpPage.evaluate (C:\Users\AH\Desktop\zyntex bot\node_modules\puppeteer-core\lib\cjs\puppeteer\api\Page.js:886:16) at async Client.sendMessage (C:\Users\AH\Desktop\zyntex bot\node_modules@juzi\whatsapp-web.js\src\Client.js:903:28)

Node.js v18.14.1

Steps đồ sộ Reproduce the Bug or Issue

It occures when trying đồ sộ send videos that downloaded for ytdl-core(only for some videos)

Relevant Code

client.on('message', async (message) => { if (message.body.startsWith('.yt')){

  const url = message.body.slice(3).trim()

  try{
    
    ytdl.getInfo(url).then((res) => {
      const videoTitle = res.videoDetails.title

      message.reply('_*Downloading...*_\n' + '_' + videoTitle + '_')

      const videoStream = ytdl(url, { quality: 'lowest' })
      const videoFileName = 'Zynt3x.mp4'
      videoStream.pipe(fs.createWriteStream(videoFileName))
      
      videoStream.on('end', () => {
        async function yt(){

          const chat = await message.getChat()
          const truyền thông media = await MessageMedia.fromFilePath(videoFileName ) 

          chat.sendMessage(media, {caption: videoTitle}).then(() =>{
            fs.unlinkSync(videoFileName)
          })

        }yt()
      })
    })
  
  }catch(err){
    message.reply('*An Error Occured!*\n' + `_*${err}*_`)
  }
}

})

Browser Type

Google Chrome

WhatsApp Account Type

Standard

Does your WhatsApp trương mục have multidevice enabled?

Yes, I am using Multi Device

Environment

OS: Windows 10 Phone OS: Android

Im Using tecsom-whatsapp-web.js , because whatsapp-web.js is getting error

whatsapp version: latest

node js : v18.14.1.

Additional context

No response

i was using fluent-ffmpeg đồ sộ tải về audio from stream obtained from ytdl-core, and i was having same problem while uploading the tệp tin with sendMessage. i changed the format using toFormat method of fluent-ffmpeg đồ sộ the 'ipod' format and it worked.