[NOWEB] Voice/audio messages saved as 0-byte files in S3 storage — downloadMediaMessage 'buffer' mode returns empty buffer
Description
Voice/audio messages (OGG Opus) are saved as 0-byte empty files when using NOWEB engine with S3 media storage. Images download correctly through the same pipeline.
Version
- WAHA: 2026.2.1 (also confirmed in latest
corebranch source) - Engine: NOWEB
- Tier: PLUS
- Media storage: S3 (AWS, eu-central-1)
Steps to reproduce
- Configure WAHA with
WAHA_MEDIA_STORAGE=S3and a valid S3 bucket - Start a NOWEB session
- Receive an image message → file saved to S3 with correct size (e.g. 143KB) ✅
- Receive a voice message (PTT / audio/ogg) → file saved to S3 as 0 bytes ❌
Expected behavior
Voice/audio files should be saved with their actual content, same as images.
Actual behavior
hasMedia: truein webhook ✅media.urlpresent, pointing to S3 ✅- File exists in S3 bucket ✅
- File size: 0 bytes ❌
- No errors in WAHA logs — the save appears successful
Analysis
The NOWEB media processor in session.noweb.core.ts calls:
return (await downloadMediaMessage(
message,
'buffer', // <-- this mode
{},
{
logger: this.logger,
reuploadRequest: this.session.sock.updateMediaMessage,
},
).finally(() => {
content.url = url;
})) as Buffer;
The 'buffer' mode in Baileys silently returns an empty buffer for audio/voice messages without throwing an error. This is a known Baileys issue:
- https://github.com/WhiskeySockets/Baileys/issues/681 (wrong HKDF key for audio-as-document)
- https://github.com/openclaw/openclaw/issues/4636 (0-byte voice, fix = switch to 'stream' mode)
Images are unaffected because they go through a different decryption path in Baileys.
Suggested fix
Switch from 'buffer' to 'stream' mode and collect chunks manually:
const stream = await downloadMediaMessage(
message,
'stream',
{},
{
logger: this.logger,
reuploadRequest: this.session.sock.updateMediaMessage,
},
);
const chunks = [];
for await (const chunk of stream) {
chunks.push(chunk);
}
return Buffer.concat(chunks);
This is the fix confirmed working in openclaw/openclaw#4636.
Environment
- OS: Linux x64 (Docker on AWS EC2)
- Deployment: Coolify
- S3 config:
WAHA_S3_PROXY_FILES=false,WHATSAPP_FILES_LIFETIME=86400 - No
WHATSAPP_FILES_MIMETYPESrestriction (all types enabled) WHATSAPP_DOWNLOAD_MEDIAnot set (defaults true)
Opened a PR with the fix: #1997. Tested in production — voice messages now download correctly (58KB instead of 0 bytes).