Fix WhatsApp connection 405 by fetching latest version
This commit is contained in:
@@ -57,9 +57,9 @@ async function startSession(session_key, webhook_url) {
|
|||||||
const sessionFolder = path.join(SESSIONS_DIR, session_key);
|
const sessionFolder = path.join(SESSIONS_DIR, session_key);
|
||||||
const { state, saveCreds } = await useMultiFileAuthState(sessionFolder);
|
const { state, saveCreds } = await useMultiFileAuthState(sessionFolder);
|
||||||
|
|
||||||
// Use a hardcoded stable version to prevent parsed timestamp version errors which reject pairing
|
// Fetch the latest version from WhatsApp web to prevent 405 Connection Failure
|
||||||
const version = [2, 3000, 1017, 0];
|
const { version, isLatest } = await fetchLatestBaileysVersion();
|
||||||
console.log(`[Baileys] Using stable WA version: ${version}`);
|
console.log(`[Baileys] Using WA version: ${version} (isLatest: ${isLatest})`);
|
||||||
|
|
||||||
const logger = pino({ level: 'silent' });
|
const logger = pino({ level: 'silent' });
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user