Describe the bug
Sometimes, when trying to download a message using the downloadMediaMessage function, it throws 403 error. I've noticed this happens mostly with PDF files.
To Reproduce
Steps to reproduce the behavior:
Receive a message event
Try to download it using the downloadMediaMessage function
Sometimes works, but other times it doesnt
Expected behavior
Media should download successfully
Environment (please complete the following information):
error: Unhandled Rejection: AxiosError: Request failed with status code 403
at settle (/home/node/app/node_modules/axios/dist/node/axios.cjs:1983:12)
at RedirectableRequest.handleResponse (/home/node/app/node_modules/axios/dist/node/axios.cjs:3033:9)
at RedirectableRequest.emit (node:events:519:28)
at RedirectableRequest._processResponse (/home/node/app/node_modules/follow-redirects/index.js:398:10)
at RedirectableRequest._onNativeResponse (/home/node/app/node_modules/follow-redirects/index.js:91:12)
at Object.onceWrapper (node:events:634:26)
at ClientRequest.emit (node:events:519:28)
at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:698:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
at TLSSocket.socketOnData (node:_http_client:540:22)
at Axios.request (/home/node/app/node_modules/axios/dist/node/axios.cjs:4224:41)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async getHttpStream (/home/node/app/node_modules/@whiskeysockets/baileys/lib/Utils/messages-media.js:320:21)
at async downloadEncryptedContent (/home/node/app/node_modules/@whiskeysockets/baileys/lib/Utils/messages-media.js:453:21)
at async downloadMsg (/home/node/app/node_modules/@whiskeysockets/baileys/lib/Utils/messages.js:733:24)
at async downloadMediaMessage (/home/node/app/node_modules/@whiskeysockets/baileys/lib/Utils/messages.js:693:20)
at async MediaManagerUtil.downloadMedia (/home/node/app/api/baileys/utils/mediaManager.util.js:19:24)
at async WatizeMessageFormatUtil.format (/home/node/app/api/baileys/utils/watize-message-format.util.js:187:45)
at async SessionBaileysConnect.receiveMessage (/home/node/app/api/baileys/layers/base.layer.js:281:34)
Describe the bug Sometimes, when trying to download a message using the
downloadMediaMessage
function, it throws 403 error. I've noticed this happens mostly with PDF files.To Reproduce Steps to reproduce the behavior:
downloadMediaMessage
functionExpected behavior Media should download successfully
Environment (please complete the following information):
What do your
connectOptions
look like?Additional context Console error