YogaSakti / imageToSticker

Whatsapp Bot - sticker creator
269 stars 218 forks source link

Error UnhandledPromiseRejectionWarning: Error: Evaluation failed: n #134

Closed dngda closed 3 years ago

dngda commented 3 years ago

Step to reproduce

Node v14.15.4 Puppeteer v7.0.0 open-wa/wa-automate v3.4.1

Setelah update open-wa ke versi 3.4.1 terjadi error saat proses sticker

case 'sticker':
        case 'stiker': {
            if ((isMedia || isQuotedImage) && args.length === 0) {
                const encryptMedia = isQuotedImage ? quotedMsg : message
                const _mimetype = isQuotedImage ? quotedMsg.mimetype : mimetype
                const mediaData = await decryptMedia(encryptMedia, uaOverride)
                const imageBase64 = `data:${_mimetype};base64,${mediaData.toString('base64')}`
                client.sendImageAsSticker(from, imageBase64).then(() => {
                    client.reply(from, 'Here\'s your sticker')
                    console.log(`Sticker Processed for ${processTime(t, moment())} Second`)
                })
            } else if (args[0] === 'nobg') {
                /**
                * This is Premium feature.
                * Check premium feature at https://trakteer.id/red-emperor/showcase or chat Author for Information.
                */
                client.reply(from, 'ehhh, what\'s that???', id)
            } else if (args.length === 1) {
                if (!is.Url(url)) { await client.reply(from, 'Maaf, link yang kamu kirim tidak valid. [Invalid Link]', id) }
                client.sendStickerfromUrl(from, url).then((r) => (!r && r !== undefined)
                    ? client.sendText(from, 'Maaf, link yang kamu kirim tidak memuat gambar. [No Image]')
                    : client.reply(from, 'Here\'s your sticker')).then(() => console.log(`Sticker Processed for ${processTime(t, moment())} Second`))
            } else {
                await client.reply(from, 'Tidak ada gambar! Untuk membuka daftar perintah kirim #menu [Wrong Format]', id)
            }
            break
        }

throw err

(node:8924) UnhandledPromiseRejectionWarning: Error: Evaluation failed: n at ExecutionContext._evaluateInternal (E:\node\imageToSticker\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:218:19) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async ExecutionContext.evaluate (E:\node\imageToSticker\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:107:16) (node:8924) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

dngda commented 3 years ago

Gw hapus uaOverride nya langsung bisa anjm