Baileys icon indicating copy to clipboard operation
Baileys copied to clipboard

[BUG] message.upsert events stop

Open nrbrttth opened this issue 1 year ago • 4 comments

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:

  1. Created some new connection
  2. Wait for some time (mostly 4-5 hours)
  3. 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!

nrbrttth avatar Apr 29 '23 15:04 nrbrttth

same issue

mrfzvx12 avatar Apr 29 '23 15:04 mrfzvx12

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?

laxeder avatar May 07 '23 17:05 laxeder

Did you find the reason? I have the same problem

sultanlive avatar May 08 '23 14:05 sultanlive

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.

nrbrttth avatar Jun 14 '23 12:06 nrbrttth

Add this option in makeWASocket:

makeWASocket({
   ...,
   defaultQueryTimeoutMs: undefined // add this
})

okfull avatar Jul 01 '23 11:07 okfull

Tracking issue in https://github.com/WhiskeySockets/Baileys/issues/34

Auties00 avatar Oct 05 '23 11:10 Auties00