From e82d71db402b49434a1c0bba70e49817e77df827 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Sun, 5 Jul 2026 15:09:22 -0700 Subject: [PATCH] fix(whatsapp): set client_max_size on the webhook Application MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to the salvaged #54944: before this, aiohttp's implicit 1 MiB default client_max_size tripped BEFORE the intended 3 MB Meta cap could apply on read() paths — the explicit value makes the documented limit real while the bounded reader keeps chunked bodies from buffering past 3 MB (#58536/#58902/#59180 pattern). --- gateway/platforms/whatsapp_cloud.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gateway/platforms/whatsapp_cloud.py b/gateway/platforms/whatsapp_cloud.py index c2ff0268e45..c97122ede1d 100644 --- a/gateway/platforms/whatsapp_cloud.py +++ b/gateway/platforms/whatsapp_cloud.py @@ -415,7 +415,10 @@ class WhatsAppCloudAdapter(WhatsAppBehaviorMixin, BasePlatformAdapter): ) # Inbound webhook server. - app = web.Application() + # client_max_size backstops the bounded reader in _handle_webhook — + # aiohttp enforces the cap on request.read()/post() paths too + # (#58536/#58902/#59180 pattern). + app = web.Application(client_max_size=WEBHOOK_MAX_BODY_BYTES) app.router.add_get(self._health_path, self._handle_health) app.router.add_get(self._webhook_path, self._handle_verify) app.router.add_post(self._webhook_path, self._handle_webhook)