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

[BUG] Error 403 on downloading media #1094

Open
Rubens-Gasparotto opened this issue Oct 17, 2024 · 1 comment
Open

[BUG] Error 403 on downloading media #1094

Rubens-Gasparotto opened this issue Oct 17, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Rubens-Gasparotto
Copy link

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:

  1. Receive a message event
  2. Try to download it using the downloadMediaMessage function
  3. Sometimes works, but other times it doesnt

Expected behavior
Media should download successfully

Environment (please complete the following information):

  • Is this on a server? Yes
  • What do your connectOptions look like?
makeWASocket({
   version, // v2.3000.1015901307
   logger: pinoLogger,
   printQRInTerminal: false,
   auth: {
       creds: state.creds,
       keys: addTransactionCapability(state.keys, pinoLogger, { maxCommitRetries: 10, delayBetweenTriesMs: 250 }),
   },
   msgRetryCounterCache: new NodeCache(),
   syncFullHistory: false,
   getMessage: async (key: WAMessageKey) => {
       if (projectScope.store) {
           const msg = await projectScope.store.loadMessage(key.remoteJid!, key.id!)
           return msg?.message || undefined
       }

       return Baileys.Message.fromObject({})
   },
   shouldSyncHistoryMessage: msg => {
       console.log(`Syncing chats [${msg.progress}%] - Type: ${msg.syncType}`);

       this.session.syncing = msg.progress !== 100;

       return !!msg.syncType;
   }
});
  • Do you have multiple clients on the same IP? No
  • Are you using a proxy? No

Additional context
Console error

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)
@Rubens-Gasparotto Rubens-Gasparotto added the bug Something isn't working label Oct 17, 2024
@lucasdoctype
Copy link

Same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants