mirror of
https://github.com/Luchexx/wacrm.git
synced 2026-11-02 17:29:45 +00:00
The POST handler ack'd Meta with 200 and then ran processWebhook() as a detached promise. On Vercel the function can be frozen/terminated the moment the response is sent, so those DB writes were not guaranteed to complete. This dropped a non-deterministic subset of inbound messages: the contact and conversation rows (written first) landed, but the message insert (written after) often did not — leaving conversations that appear in the inbox with an empty thread, with no durable logs to explain it (issue #301). Move the work into next/server `after()`, which keeps the function alive until the callback resolves (within the route's maxDuration) while still ack'ing Meta fast enough to avoid retry-driven duplicate inserts. Add maxDuration=60 for headroom since processing can fan out to per-media Meta verification calls. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| route.ts | ||