Repository navigation
fix(baileys): ack incoming status stanzas - #2788
Open
daniloleonecarneiro wants to merge 1 commit into
Open
daniloleonecarneiro wants to merge 1 commit into
daniloleonecarneiro wants to merge 1 commit into
Conversation
WhatsApp now sends <status> stanzas to linked devices and expects an ack.
Baileys 7.0.0-rc.9 drops them unacknowledged, so the server ends the stream
("stream errored out", ack class=status) and the instance reconnects in a
state where it stays "open" but stops receiving messages.
Patch Baileys via patch-package to ack <status> both online (CB:status) and
in the offline node queue. The Docker builder copies patches/ before npm ci
so the postinstall hook applies it in the image.
Contributor
|
Sorry @daniloleonecarneiro, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 1 hour and 42 minutes by commenting |
Contributor
Reviewer's GuideImplementationPatch Baileys to acknowledge incoming status stanzas in both the online event handler and offline node processor.
ConfigurationApply the Baileys patch during installation and ensure the Docker builder has the patch directory before running npm ci.
DocumentationDocument how patches are applied and why the patches directory must remain present for Docker builds.
Lock files and vendored codeRecord the patch-package dependency and its transitive dependencies in the lockfile.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 Description
WhatsApp now sends a
<status>stanza to linked devices and expects it to be acked. Baileys7.0.0-rc.9(shipped in 2.3.7) never acks it. After roughly 50 minutes the server ends the stream (stream errored out,ack class=status, 3–9 times per hour). The instance then reconnects and showsopen, but it stops receiving messages or gets them hours late. Restarting the instance does not help.This hotfix patches Baileys with
patch-package:handleStatusacks the node (sendMessageAck(node)).['status', handleStatus]) and asws.on('CB:status', ...), next toCB:notification.Build support for the patch:
patch-packageadded as a devDependency, plus apostinstallhook.Dockerfilecopiespatches/beforenpm ci, so the image ships the patchednode_modules.The lockfile diff only adds
patch-packageand its dependencies.Neither the latest Baileys releases (
rc13,rc14) nordevelophandleCB:statusyet.develop(Baileysrc13) already has thepatch-packagesetup, so it needs the equivalentbaileys+7.0.0-rc13.patchwhen this is merged back.🔗 Related Issue
Reported by the community; no issue opened.
🧪 Type of Change
🧪 Testing
npm ciappliesbaileys@7.0.0-rc.9 ✔.<status>node is emitted onCB:status. With the patch, both the online and the offline (offlineattr) paths send<ack class='status' .../>. Without the patch, nothing is sent. The same test passes inside the built Docker image.docker buildsucceeds. The API boots on Postgres, and a new Baileys instance completes the WhatsApp handshake and returns a QR code.✅ Checklist
Summary by Sourcery
Prevent Baileys connections from stalling by acknowledging incoming status stanzas and applying the fix consistently across local and Docker installations.
Bug Fixes:
Enhancements:
Build:
Documentation: