From 0b6aee9e809f3f3691acabffcc50231df4129f34 Mon Sep 17 00:00:00 2001 From: Prateek Date: Sat, 14 Feb 2026 16:26:51 +0530 Subject: [PATCH] fix: prevent unhandled promise rejection after timeout in composio notifier Attach a no-op .catch() to the executeAction promise so that if the timeout fires first and the action later rejects, it doesn't trigger an unhandledRejection event. Co-Authored-By: Claude Opus 4.6 --- packages/plugins/notifier-composio/src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/plugins/notifier-composio/src/index.ts b/packages/plugins/notifier-composio/src/index.ts index 8b438b5e6..0c8b37b5d 100644 --- a/packages/plugins/notifier-composio/src/index.ts +++ b/packages/plugins/notifier-composio/src/index.ts @@ -209,8 +209,12 @@ export function create(config?: Record): Notifier { const timeoutMs = 30_000; const timeoutSignal = AbortSignal.timeout(timeoutMs); + const actionPromise = composio.executeAction({ action, params }); + // Prevent unhandled rejection if the timeout fires and actionPromise later rejects + actionPromise.catch(() => {}); + const result = await Promise.race([ - composio.executeAction({ action, params }), + actionPromise, new Promise((_, reject) => { timeoutSignal.addEventListener("abort", () => { reject(new Error(`[notifier-composio] Composio API call timed out after ${timeoutMs / 1000}s`));