From d4c5576c2f80701ceae18ffb5195cb315abfaea3 Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Sat, 23 May 2026 17:17:07 +0300 Subject: [PATCH] Fix WhatsApp connection 405 by fetching latest version --- whatsapp-gateway/baileys-client.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/whatsapp-gateway/baileys-client.js b/whatsapp-gateway/baileys-client.js index 0c8214e..1928428 100644 --- a/whatsapp-gateway/baileys-client.js +++ b/whatsapp-gateway/baileys-client.js @@ -57,9 +57,9 @@ async function startSession(session_key, webhook_url) { const sessionFolder = path.join(SESSIONS_DIR, session_key); const { state, saveCreds } = await useMultiFileAuthState(sessionFolder); - // Use a hardcoded stable version to prevent parsed timestamp version errors which reject pairing - const version = [2, 3000, 1017, 0]; - console.log(`[Baileys] Using stable WA version: ${version}`); + // Fetch the latest version from WhatsApp web to prevent 405 Connection Failure + const { version, isLatest } = await fetchLatestBaileysVersion(); + console.log(`[Baileys] Using WA version: ${version} (isLatest: ${isLatest})`); const logger = pino({ level: 'silent' });