fix(noweb): use stream mode for media download to fix 0-byte audio files#1997
Open
daniel-rudaev wants to merge 1 commit intodevlikeapro:corefrom
Open
fix(noweb): use stream mode for media download to fix 0-byte audio files#1997daniel-rudaev wants to merge 1 commit intodevlikeapro:corefrom
daniel-rudaev wants to merge 1 commit intodevlikeapro:corefrom
Conversation
The 'buffer' mode in Baileys' downloadMediaMessage() silently returns an empty buffer for audio/voice messages (PTT, OGG Opus), while images download correctly. Switching to 'stream' mode and collecting chunks manually resolves the issue. Tested in production (WAHA Plus 2026.3.4, NOWEB engine, S3 storage): - Before: voice messages saved as 0 bytes in S3 - After: voice messages saved with correct size (58,005 bytes confirmed) Fixes devlikeapro#1996
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.
Summary
Fixes #1996 — voice/audio messages (PTT, OGG Opus) are saved as 0-byte empty files when using NOWEB engine with S3 media storage, while images download correctly.
Root cause
downloadMediaMessage()in Baileys silently returns an empty buffer for audio messages when called with'buffer'mode. No error is thrown — the file is simply empty.Related Baileys issues:
Fix
Switch from
'buffer'to'stream'mode and collect chunks manually. One-method change ingetMediaBuffer().Tested in production
WAHA Plus 2026.3.4, NOWEB engine, S3 storage (AWS eu-central-1):
The patched compiled JS has been running in production since 2026-04-02 with no issues.