[BUG] - fetchLatestBaileysVersion() breaks the WA connection
Describe the bug
const { version, isLatest } = await fetchLatestBaileysVersion(); // <- Here is the problem!
In the code above, when the function is called, the code never returns, causing the WhatsApp connection to become unavailable. If you set a breakpoint before calling the function and another one after it to inspect the returned values, the breakpoint after the function is never hit.
I tested commenting out this line and setting the version in makeWASocket to a fixed value, and everything went back to working normally.
To Reproduce Steps to reproduce the behavior: 1 - Try to scan the QR Code to connect WhatsApp. 1.1 - If the status is "OPENING", change it manually on database to "DISCONNECTED" and reload the page. 2 - Turn on the debugger and place breakpoints before and after the fetchLatestBaileysVersion() function. 3 - Check that the breakpoint after the function is never hit. 4 - Try commenting out the function call and set a fixed value for the version parameter in makeWASocket, for example → version: [2, 3000, 1029030078]. 5 - Watch it work.
Environment (please complete the following information): I’m using Baileys version 6.7.18.
this is the current version, and it stopped working like 2h ago too. we may need to migrate to 7.x.x version:[2 ,3000, 1023223821], isLatest:false
step 4 version seems to work just fine
this is the current version, and it stopped working like 2h ago too. we may need to migrate to 7.x.x version:[2 ,3000, 1023223821], isLatest:false
step 4 version seems to work just fine
what version??? my just stoped work too..
The fetchLatestBaileysVersion() function gets the Baileys version from GitHub:
https://raw.githubusercontent.com/WhiskeySockets/Baileys/master/src/Defaults/index.ts
But this URL returns a 429 error.
Time to think of another way to do this.
I tested the same snippet on Baileys v7.0.0-rc.6, and it worked fine — fetchLatestBaileysVersion() returned normally and the connection initialized without freezing.
Here’s the snippet I used for reference:
const { state, saveCreds } = SQLiteAuth();
const { version: baileysVersion } = await fetchLatestBaileysVersion();
logger.info(`[baileys] v${baileysVersion.join(".")} on ${process.platform.toUpperCase()}`);
const connectionOptions = {
version: baileysVersion,
logger: pino({
level: "error",
base: { module: "BAILEYS" },
transport: {
target: "pino-pretty",
options: {
colorize: true,
translateTime: "HH:MM",
ignore: "pid,hostname",
},
},
}),
browser: Browsers.ubuntu("Safari"),
auth: {
creds: state.creds,
keys: SQLiteKeyStore(),
},
};
No hanging or timeout occurred in my tests.
are u guys from south america?
https://github.com/orgs/community/discussions/177971
things arent working very well for us right now and github doesn't care one bit about it... ;/
I am also using v6.7.18 and I fixed version [2, 3000, 1027934701]. It worked
I found this line of code in the Baileys directory under “src/Defaults/index.ts”:
const version = [2, 3000, 1027934701];
It sets a fixed version, which was changed about two weeks ago.
My question now is: since I’m not using Baileys version 7.x.x, but rather version 6.7.18, could it be that my fetchLatestBaileysVersion function is retrieving an older version and therefore causing the connection error?
Sorry for my ignorance — I’m just trying to better understand how things work 😂
If it is the reason, so may i have to migrate to 7.x.x...
I found this line of code in the Baileys directory under “src/Defaults/index.ts”:
const version = [2, 3000, 1027934701];
It sets a fixed version, which was changed about two weeks ago.
My question now is: since I’m not using Baileys version 7.x.x, but rather version 6.7.18, could it be that my fetchLatestBaileysVersion function is retrieving an older version and therefore causing the connection error?
Sorry for my ignorance — I’m just trying to better understand how things work 😂
If it is the reason, so may i have to migrate to 7.x.x...
I think the only real way to avoid this issue is by migrating, since it’s hardcoded in the codebase as you mentioned. I’m running into the same problem here — do you know any site where I can check the latest stable Baileys versions? I’ve tried wa versions, but it only lists the alpha releases.
I think the only real way to avoid this issue is by migrating, since it’s hardcoded in the codebase as you mentioned. I’m running into the same problem here — do you know any site where I can check the latest stable Baileys versions? I’ve tried wa versions, but it only lists the alpha releases.
I dont know any site to check the latest stable Baileys version... It would be nice if it had that! To work around the error and be able to use it without migrating, I manually set the version I got from “wa versions” myself. It’s not the recommended approach, though — alternatively, you can check the code and grab the version that was set in the latest Baileys update. Theoretically, if they defined that version, it’s because it’s compatible with the Baileys version.
Thanks @FabioTessaro19 👍
If you constantly experience connection and disconnection , use @whiskeysockets/baileys version 6.7.21.