Skip to content

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
D1DX:fix/noweb-audio-buffer-to-stream
Open

fix(noweb): use stream mode for media download to fix 0-byte audio files#1997
daniel-rudaev wants to merge 1 commit intodevlikeapro:corefrom
D1DX:fix/noweb-audio-buffer-to-stream

Conversation

@daniel-rudaev
Copy link
Copy Markdown

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 in getMediaBuffer().

Tested in production

WAHA Plus 2026.3.4, NOWEB engine, S3 storage (AWS eu-central-1):

Before After
Voice message (OGG) 0 bytes 58,005 bytes ✅
Image (JPEG) Works Works ✅

The patched compiled JS has been running in production since 2026-04-02 with no issues.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NOWEB] Voice/audio messages saved as 0-byte files in S3 storage — downloadMediaMessage 'buffer' mode returns empty buffer

1 participant