Baileys
Baileys copied to clipboard
[BUG] message.upsert events stop
Hello all!
Describe the bug I'm facing a problem when starting a process, connecting some phone numbers through QR code, everything's working fine, I can send messages, receive upsert events. But after some time (4-5 hours) the socket stops receiving the upsert events. I can still connect/disconnect, but the message upsert events won't come.
To Reproduce Steps to reproduce the behavior:
- Created some new connection
- Wait for some time (mostly 4-5 hours)
- Message events won't come, though there are active conversations
Expected behavior The message events shouldn't stop, or if there's any problem with the socket, there should be an error message.
Environment:
- Express.js server running 5-6 socket connections (later we want more)
- My
connectOptions
:
const browser = Browsers.appropriate('Desktop');
const socket = makeWASocket({
logger: this.logger, // pino logger with level 'error'
syncFullHistory: false,
shouldSyncHistoryMessage: () => false,
auth: { // custom MySQL auth state
creds: state?.creds,
keys: state?.keys,
},
browser: browser
});
- No proxy used
Any help would be welcome!
same issue
I'm facing the same problem. I also use a custom authentication method (fork of useMultiFileAuthState | redis db).
I'm considering this to be the problem and also the use of poll messages, I use it as a substitute for interactive messages, decrypting each poll message update.
Did you find a solution for this problem?
Did you find the reason? I have the same problem
No success with it yet.
Right now I'm restarting all the sockets every 30 minutes, and restarting the node process every 4 hours. Would be really cool if this wasn't needed, but for now it's working.
Also tested on my local machine for a day with one phone number connected, and without restarting anything, and it worked fine. After that day tried this again, and the connections were gone after about 45 minutes... I don't what is causing this, our devops engineer guessed it could be something with the IP address, maybe with fix IP it would be ok (we're using Baileys with multiple socket connections on an express.js server with Kubernetes).
We haven't got time to investigate it further yet, but if I have something useful I will report back.
Add this option in makeWASocket:
makeWASocket({
...,
defaultQueryTimeoutMs: undefined // add this
})
Tracking issue in https://github.com/WhiskeySockets/Baileys/issues/34