From 95928c54da6c9020ff3a305a1938c871a3e0331d Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Tue, 16 Apr 2024 16:34:19 +0200 Subject: [PATCH] :bug: Attempt to fix waitUntil --- apps/builder/src/pages/api/v1/whatsapp/preview/webhook.ts | 2 +- .../[workspaceId]/whatsapp/[credentialsId]/webhook.ts | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/builder/src/pages/api/v1/whatsapp/preview/webhook.ts b/apps/builder/src/pages/api/v1/whatsapp/preview/webhook.ts index 4b0c1e90c..6646845dd 100644 --- a/apps/builder/src/pages/api/v1/whatsapp/preview/webhook.ts +++ b/apps/builder/src/pages/api/v1/whatsapp/preview/webhook.ts @@ -32,7 +32,7 @@ export default async function handler( // @ts-ignore const ctx = globalThis[Symbol.for('@vercel/request-context')] if (ctx?.get?.().waitUntil) { - ctx.get().waitUntil(() => processWhatsAppReply(entry)) + ctx.get().waitUntil(processWhatsAppReply(entry)) return res.status(200).json({ message: 'Message is being processed.' }) } console.log('Processing message') diff --git a/apps/viewer/src/pages/api/v1/workspaces/[workspaceId]/whatsapp/[credentialsId]/webhook.ts b/apps/viewer/src/pages/api/v1/workspaces/[workspaceId]/whatsapp/[credentialsId]/webhook.ts index a38c86b57..f88a8b9e2 100644 --- a/apps/viewer/src/pages/api/v1/workspaces/[workspaceId]/whatsapp/[credentialsId]/webhook.ts +++ b/apps/viewer/src/pages/api/v1/workspaces/[workspaceId]/whatsapp/[credentialsId]/webhook.ts @@ -56,9 +56,7 @@ export default async function handler( if (ctx?.get?.().waitUntil) { ctx .get() - .waitUntil(() => - processWhatsAppReply({ entry, workspaceId, credentialsId }) - ) + .waitUntil(processWhatsAppReply({ entry, workspaceId, credentialsId })) return res.status(200).json({ message: 'Message is being processed.' }) } const { message } = await processWhatsAppReply({