Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "STICKER_TOO_LARGE" on files less then 1mb big, even 200kB ones fail? #3175

Open
1 task done
TVARecordings opened this issue Mar 13, 2024 · 1 comment
Open
1 task done

Comments

@TVARecordings
Copy link

Are you using the latest version of the library?

  • I have checked and am using the latest version of the library.

What type of session are you experiencing this issue on?

Multi-device and I have set multiDevice to true in my config OR am using the --multi-device flag

What type of host account are you experiencing this issue on?

Business account

Mode

EASY API/CLI

Current Behavior

Dear,

Sometimes when users send in media or a url to be converted into a WA-Sticker, it returns the error "Error processing media: STICKER_TOO_LARGE: maxContentLength size of 1500000 exceeded".

However, i've inspected multiple of those errors and 9 out of 10 cases, it was NOT too big.

Usually it errors when media is 10+ seconds, even though the media is of low quality (FPS, resolution) and perhaps only 300kB's big.

Expected Behavior

Properly return the sent media as a sticker.

Steps To Reproduce

Code:

} else if (message.type === 'chat') {
              try {
                
                let splitmessage = mediaMessage.body.split(' ')[1] || mediaMessage.caption.split(' ')[1]
                let link = splitmessage.toString()
                console.log(`Link = ${link}`)
                if (splitmessage.startsWith('http') || splitmessage.startsWith('www') || splitmessage.startsWith('https')) {
                  console.log(`sendStickerfromUrl`)
                  // Create a new Date object to get the current date
                  const currentDate = new Date();
                  const day = currentDate.getDate().toString().padStart(2, '0'); // Get the day and pad with leading zero if needed
                  const month = (currentDate.getMonth() + 1).toString().padStart(2, '0'); // Get the month (months are zero-based) and pad with leading zero if needed
                  const year = currentDate.getFullYear().toString().slice(-2); //
                  //await client.sendStickerfromUrl(from, splitmessage, {}, { crop: false, startTime: '00:00:00.0', endTime: '00:00:09.0', loop: 0, author: `🤖 Ameca ${day}/${month}/${year}`, pack: `📱 www.tva-community.chat`, keepScale: true, discord: '234717932175884288' })
                  await client.sendStickerfromUrl(from, link, {},{author: `🤖 Ameca ${day}/${month}/${year}`, pack: `📱 www.tva-community.chat`})
                  if (IsBotChat) {
                    await client.sendStickerfromUrl(`[email protected]`, link,{}, { author: `🤖 Ameca ${day}/${month}/${year}`, pack: `📱 www.tva-community.chat`})
                    //client.sendStickerfromUrl(`[email protected]`, splitmessage, {}, { crop: false, startTime: '00:00:00.0', endTime: '00:00:09.0', loop: 0, author: `🤖 Ameca ${day}/${month}/${year}`, pack: `📱 www.tva-community.chat`, keepScale: true, discord: '234717932175884288' });
                  }
                } else {
                  client.reply(from, `Please, send an \`\`\`GIF/IMAGE\`\`\` or a \`\`\`URL\`\`\` with your message\nMake sure url's start with 'http', 'https' or 'www'`, id);
                }

              } catch (error) {
                errorLog(`Error processing "message.type === chat" for case 'sticker': ${error}`)
                console.error(error)
                client.sendTextWithMentions(from, `@${message.sender.id.split('@')[0]}: ${error}`)
              };

A link that does result in error: https://c.tenor.com/asuzYlr9bmAAAAAd/tenor.gif
According program "MediaInfo" on my PC:
Format: GIF
Format/Info: Graphics Interchange Format
Format profile: 89a (don't know what this means...)
Width: 554 pixels
Height: 640 pixels
Compression Mode: Lossless

create() code OR full CLI command + CONFIG

const configObject = {
  sessionId: '???',
  authTimeout: 0,
  cacheEnabled: false,
  useChrome: true,
  cachedPatch: true, // Setting this to true will save a local copy of the patches.json file (as patches.ignore.data.json) which will be used in subsequent instantiations of the session.
  devtools: false,
  // chromiumArgs: ['--no-sandbox'],
  disableSpins: true,
  headless: true, //new
  popup: false,
  qrTimeout: 0,
  messagePreprocessor: "AUTO_DECRYPT", //"AUTO_DECRYPT","SCRUB"
  linkParser: "https://link.openwa.cloud/api",
  restartOnCrash: startBot,
  logInternalEvents: false, //ONLY TURN THIS ON IF ASKED TO!
  discord: '???',
  ezqr: true,
  //callTimeout: 60000, // 600000
  licenseKey: "???", // Ain't sharing that :D
  screenshotOnInitializationBrowserError: false,
  //maxchats: 15,
  ensureHeadfulIntegrity: true,
  hostNotificationLang: 'nl-nl',
  killProcessOnBrowserClose: true,
  killProcessOnTimeout: false,
  logConsole: false,
  logConsoleErrors: true,
  logFile: true,
  onError: "LOG_AND_FALSE",
  //pQueueDefault: true,
  //intervalCap: 4,
  // interval: 2000,
  // concurrency: 1,
  // timeout: 100, 
  // carryoverConcurrencyCount: true 
};

DEBUG INFO

{
  "WA_VERSION": "2.2411.2",
  "WA_AUTOMATE_VERSION": "4.68.0",
  "BROWSER_VERSION": "Chrome/122.0.6261.112",
  "START_TS": 1710289040067,
  "RAM_INFO": "Total: 68.62 GB | Free: 47.40 GB",
  "PPTR_VERSION": "19.11.1",
  "LATEST_VERSION": true,
  "CLI": false,
  "PATCH_HASH": "CACHED-67662",
  "LAUNCH_TIME_MS": 14946,
  "ACC_TYPE": "BUSINESS",
  "chats": 112,
  "messages": 198,
  "contacts": 3172,
  "isBiz": true,
  "isMd": true,
  "INSTANCE_ID": "2695ea9e-30a7-48f6-8836-00c070035e92"
}

Environment

- OS: Windows 10
- Node: 20.11.1
- npm: 10.2.4

Screenshots/Logs

No response

Anything else?

Please, allow users to convert larger file sizes (Perhaps make it a paid feature :D )

@Vinnybrunn00
Copy link

Hello, @TVARecordings.

I've never used the sendStickerfromUrl() function, but I've had this same problem with sendMp4AsSticker().

  • I only had this problem with animated stickers.

I solved the problem by adding endTime to the processOptions? parameter.

here is an example:

if (message.type === 'image' || message.type === 'video') {
            const isType = message.type
            if (message.caption === '!sticker') {
                if (message.chat.isGroup) {
                    await bot.sendReplyWithMentions(message.chat.id, `\`\`\`[${timers}] - Solicitado por ${message.notifyName}\`\`\` \n\nAguarde...⌛`, message.id)
                    const decrypt = await decryptMedia(message)
                    const sticker = `data:${message.mimetype};base64,${decrypt.toString('base64')}`
                    if (isType === 'image') {
                        await bot.sendImageAsSticker(message.chat.id, sticker, {
                            author: `${message.notifyName}`,
                            keepScale: true,
                            pack: 'hubberBot',
                        })
                        await utils.saveLog(pathLog, `${timersLog}: [${author}] [INFO] Gerando sticker com imagem... '${message.chat.name}' => [ !sticker ]`)
                        return;
                    }
                    await bot.sendMp4AsSticker(message.chat.id, sticker, { endTime: '00:00:07.0' }, {
                        author: `${message.notifyName}`,
                        pack: 'hubberBot',
                    })
                    await utils.saveLog(pathLog, `${timersLog}: [${author}] [INFO] Gerando sticker com vídeo... '${message.chat.name}' => [ !sticker ]`)
                    return;
                }
            }
        }

Based on this example, with several tests I did, wa-automate does not accept generating animated stickers longer than 8 seconds.

I hope it helps! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants