WhiskeySockets / Baileys

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

[BUG] requestPairingCode Fails with 400 Error: 'bad-request' #1016

Closed Guru322 closed 3 months ago

Guru322 commented 3 months ago

Describe the bug When attempting to request a pairing code, received a 400 Bad Request error

To Reproduce Steps to reproduce the behavior:

  1. Created a new connection
  2. Requested Pairing code using 'socket.requestPairingCode'

Expected behavior should successfully connect to WhatsApp

Environment :

Additional context Baileys version - 6.7.7

Full logs :


  Your Pairing Code : CHTXBT83
{"level":10,"time":1724560388980,"pid":16100,"hostname":"Guru-ArchLinux","class":"ns","msg":"recv 64 bytes, total recv 64 bytes"}
{"level":10,"time":1724560388981,"pid":16100,"hostname":"Guru-ArchLinux","class":"ns","msg":"37114.30880-1","msg":"recv frame"}
{"level":10,"time":1724560388981,"pid":16100,"hostname":"Guru-ArchLinux","xml":"<iq from='@s.whatsapp.net' type='error' id='37114.30880-1'>\n\t\t<error code='400' text='bad-request'/>\n</iq>","msg":"recv xml"}
Guru322 commented 3 months ago

 setTimeout(async () => {
          try {
            let code = await socket.requestPairingCode(phoneNumber)
            console.log(`Your Pairing Code : ${code}`)
            resolve(code)
          } catch (requestPairingCodeError) {
            const errorMessage = 'Error requesting pairing code from WhatsApp'
            console.error(errorMessage, requestPairingCodeError)
            return reject(new Error(errorMessage))
          }
        }, 5000)