WhiskeySockets / Baileys

Lightweight full-featured typescript/javascript WhatsApp Web API
https://baileys.whiskeysockets.io/
MIT License
4.1k stars 1.38k forks source link

[BUG] Download Media reupload not working #507

Open pilosof opened 1 year ago

pilosof commented 1 year ago

Describe the bug reupload media request not working. fails with Error: Unsupported state or unable to authenticate data

sending reupload media request...
2023-11-17 10:53:06 messages.media-update [{"key":{"id":"3AF0F066499B099D1966","remoteJid":"972525417470-1522859360@g.us","fromMe":false,"participant":"972544819773@s.whatsapp.net"},"media":{"ciphertext":{"type":"Buffer","data":[34,136,81,220,230,33,94,121,75,233,198,5,171,227,231,213,57,102,76,32,101,209,140,224,183,153,208,59,77,245,139,25,177,48,17,195,151,56,186,251,250,234,95,195,15,187,105,234,189,22,148,16,31,68,184,117,227,238,104,230,180,25,190,81,210,255,252,162,58,186,22,108,131,51,0,168,246,182,194,133,185,82,231,97,54,157,205,220,52,53,245,129,111,122,152,70,223,180,178,10,144,173,70,24,243,32,223,214,23,22,129,102,207,108,23,4,247,159,68,9,178,172,164,157,10,4,106,232,4,58,243,132,50,186,232,93,74,69,136,250,223,41,210,111,160,24,65,1,161,192,120,131,117,39,186,186,121,76,249,101,186,149,129,22,3,110,25,31,242,239,218,232,199,98,158,230,51,204,217,203,200,27,222,31,99,96,206,183,43,246,151,227,129,232,204,90,88,247,201,199,16,98,86,181,19,17,44,2,76,79,211,195,29,208,89,20,232]},"iv":{"type":"Buffer","data":[127,146,137,64,65,181,157,221,158,122,150,145]}}}]
download.exd Error: Unsupported state or unable to authenticate data
    at Decipheriv.final (internal/crypto/cipher.js:174:29)
    at aesDecryptGCM (/host.storage/projects/hop/projects/wa/node_modules/@whiskeysockets/baileys/lib/Utils/crypto.js:93:58)
    at decryptMediaRetryData (/host.storage/projects/hop/projects/wa/node_modules/@whiskeysockets/baileys/lib/Utils/messages-media.js:665:50)
    at /host.storage/projects/hop/projects/wa/node_modules/@whiskeysockets/baileys/lib/Socket/messages-send.js:575:81
    at EventEmitter.listener (/host.storage/projects/hop/projects/wa/node_modules/@whiskeysockets/baileys/lib/Utils/generics.js:165:21)
    at EventEmitter.emit (events.js:412:35)
    at EventEmitter.<anonymous> (/host.storage/projects/hop/projects/wa/node_modules/@whiskeysockets/baileys/lib/Utils/event-buffer.js:40:16)
    at EventEmitter.emit (events.js:400:28)
    at Object.emit (/host.storage/projects/hop/projects/wa/node_modules/@whiskeysockets/baileys/lib/Utils/event-buffer.js:94:23)
    at processNotification (/host.storage/projects/hop/projects/wa/node_modules/@whiskeysockets/baileys/lib/Socket/messages-recv.js:249:20)
2023-11-17 10:53:07 downloadMedia:error ERR_BAD_REQUEST 410
2023-11-17 10:53:07 downloadMedia:reupload
2023-11-17 10:53:08 messages.media-update [{"key":{"id":"3AF0F066499B099D1966","remoteJid":"972525417470-1522859360@g.us","fromMe":false,"participant":"972544819773@s.whatsapp.net"},"media":{"ciphertext":{"type":"Buffer","data":[184,19,210,165,4,13,167,207,128,249,68,50,173,142,96,91,117,139,61,224,34,182,79,206,109,160,111,136,139,52,55,157,97,70,125,149,16,210,161,115,170,50,5,104,37,163,222,15,232,73,242,91,178,143,192,112,67,104,244,216,141,80,122,152,98,50,76,136,139,144,244,29,112,90,184,129,219,3,128,127,13,142,72,252,112,156,237,244,147,36,196,194,54,141,0,34,227,209,100,62,114,243,202,91,23,198,76,168,69,230,175,203,205,236,3,206,239,239,41,18,159,200,12,175,238,122,50,93,129,170,36,34,138,104,255,215,15,27,125,233,91,226,162,23,91,11,129,69,168,194,35,57,230,207,71,2,167,46,160,31,206,165,157,98,37,118,198,183,145,39,56,78,69,24,106,41,86,243,80,148,99,254,175,250,26,74,115,40,14,217,28,98,211,176,19,154,50,244,37,37,223,82,217,104,105,120,232,227,158,34,176,66,199,36,4,96,107]},"iv":{"type":"Buffer","data":[20,229,109,119,196,249,12,22,29,219,174,39]}}}]

To Reproduce Steps to reproduce the behavior:

  1. Created a new connection
  2. Request media reupload
  3. I get the messages.media-update event (which I guess should update the credentials)
  4. get exception Error: Unsupported state or unable to authenticate data

Expected behavior Should be able to decode and download the media

Environment (please complete the following information):

Additional context Add any other context about the problem here.

Riders004 commented 1 year ago

Where you want to upload media

pilosof commented 1 year ago

when Downloading Media Messages failed you request "reupload" from mobile... https://github.com/WhiskeySockets/Baileys#downloading-media-messages

abe-om commented 2 weeks ago

any solution? I have same log error