-
Notifications
You must be signed in to change notification settings - Fork 0
Fix LID Group Send Failure - Baileys senderKeyJids Filtering #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix LID Group Send Failure - Baileys senderKeyJids Filtering #12
Conversation
Baileys v6.7.19 includes sender's own devices in senderKeyJids when sending to LID-addressed groups, causing WhatsApp to reject with 'not-acceptable' error. This patch filters sender's own devices from the senderKeyJids list before sending group messages, following the same pattern Baileys uses for non-group messages (meJids vs otherJids filtering). Changes: - Add Baileys patch in patches/baileys+6.7.19+lid-group-send.patch - Update Dockerfile to apply patch after npm ci - Extract meUser from meId and meLid from authState.creds - Skip sender's own devices in senderKeyJids loop Fixes: #issue-number Related: WhiskeySockets/Baileys#1690, EvolutionAPI#1768
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Dockerfile
Outdated
| # [WIDGET-WORKS] Apply Baileys patch for LID group send fix | ||
| COPY ./patches ./patches | ||
| RUN patch -p0 < patches/baileys+6.7.19+lid-group-send.patch || echo "Patch already applied or failed" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure patch command exists before applying Baileys fix
In the Docker build (node:20-alpine) we add RUN patch -p0 < patches/baileys+6.7.19+lid-group-send.patch || echo "Patch already applied or failed", but the base layer only installs git/ffmpeg/wget/curl/bash/openssl and does not provide the patch binary. On Alpine, patch is not present by default, so this step will simply print an error and continue because of the || echo, leaving the Baileys LID group fix unapplied. Images built from this Dockerfile will still fail to send to LID groups despite the new patch.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codex fixed, please rereview
…tion Alpine Linux does not include 'patch' by default. Without this, the Baileys LID group send patch would silently fail during build, leaving the fix unapplied in production images. Changes: - Add 'patch' to apk install list - Remove '|| echo' fallback to fail fast on patch errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Dockerfile
Outdated
|
|
||
| # [WIDGET-WORKS] Apply Baileys patch for LID group send fix | ||
| COPY ./patches ./patches | ||
| RUN patch -p0 < patches/baileys+6.7.19+lid-group-send.patch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docker patch command uses wrong strip level
The new patch step invokes patch -p0 < patches/baileys+6.7.19+lid-group-send.patch, but the patch file itself uses the standard a/... and b/... prefixes (--- a/node_modules/..., +++ b/node_modules/..., see lines 1-4 in the added patch). With -p0, patch looks for a file named a/node_modules/baileys/lib/Socket/messages-send.js, which does not exist in the image, so every Docker build will fail when applying the patch. The command needs to strip the leading path component (e.g., -p1) or the patch paths must drop the a//b/ prefixes.
Useful? React with 👍 / 👎.
|
@codex please review again |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Problem
Instances cannot send messages to LID-addressed groups. WhatsApp rejects with not-acceptable error. Root Cause: Baileys v6.7.19 includes sender's own devices in senderKeyJids when sending group messages, but WhatsApp's server rejects sender keys being sent to the sender itself.
Evidence
{
"senderKeyJids": [
"219232478433331:30@s.whatsapp.net", // Admin ✅
"22033668821180@s.whatsapp.net", // SENDER ❌
"22033668821180:87@s.whatsapp.net", // SENDER devices ❌
"22033668821180:95@s.whatsapp.net", // SENDER devices ❌
"22033668821180:98@s.whatsapp.net" // SENDER devices ❌
]
}
Solution
Patch Baileys to filter sender's own devices from senderKeyJids, following the same pattern used for non-group messages (lines ~396). Changes:
Testing Plan
✅ Deploy to staging
✅ Send message to LID group from Prospek
✅ Verify message received in WhatsApp
✅ Check logs: senderKeyJids should NOT include sender's LID
✅ Deploy to production
Upstream Status