Skip to content

Bug: Fire-and-forget async calls in webhook dispatcher cause unhandled promise rejections #3943

Description

@Siddh2024

Description

sendWithRetry in \lib/webhook/dispatcher.js\ (line 72) is an async function called **without \�wait**. Similarly, \emitWebhookEvent\ in \�pp/api/attendance/record/route.js\ (line 63) is also called without \�wait.

Impact

  • If the webhook endpoint is down, the \ etch\ inside \sendWithRetry\ rejects and becomes an unhandled Promise rejection (Node.js emits \unhandledRejection, potentially crashing the process).
  • The HTTP response to the client is sent before the webhook fires, meaning the client gets a success response even though the webhook delivery may still be in-flight or might fail silently.

Files

  • \lib/webhook/dispatcher.js:72-79\ — \sendWithRetry(...)\ not awaited inside the loop
  • \�pp/api/attendance/record/route.js:63-70\ — \emitWebhookEvent(...)\ not awaited before returning response

Suggested Fix

Add \�wait\ before both calls and wrap in try/catch to handle errors gracefully.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions