-
Notifications
You must be signed in to change notification settings - Fork 3.2k
improvement(webhooks): move webhook exeucution to trigger.dev #810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR implements a significant architectural change to webhook processing by moving from synchronous to asynchronous execution using trigger.dev. The main change introduces a new webhook-execution.ts trigger task that handles webhook processing in the background, while the webhook endpoint now immediately acknowledges requests and queues them for async processing.
The refactoring involves several key components:
-
New Trigger Task:
apps/sim/trigger/webhook-execution.tscreates a new trigger.dev task that handles the actual webhook processing, including usage limit validation, input formatting for different providers (WhatsApp, Airtable, Telegram, etc.), and workflow execution with proper logging. -
Simplified Webhook Route: The webhook route handler in
apps/sim/app/api/webhooks/trigger/[path]/route.tshas been streamlined to focus on immediate validation (signature verification, challenges) and task queuing, removing complex deduplication logic and direct workflow execution. -
Utility Function Refactoring:
apps/sim/lib/webhooks/utils.tshas been simplified by removing execution-related functions and keeping only formatting, validation, and data processing utilities. The Airtable processing function now returns input data instead of executing workflows directly. -
Enhanced Chat Controls: Server-side usage limit checks have been added to chat execution in
apps/sim/app/api/chat/utils.tsto prevent users from exceeding billing limits.
This architectural change follows webhook best practices by providing immediate acknowledgments (preventing provider retries due to timeouts) while ensuring reliable background processing. The implementation aligns webhook execution with the existing async workflow execution pattern used elsewhere in the codebase.
Confidence score: 3/5
• This change has moderate risk due to significant architectural refactoring of webhook processing logic
• Score reflects concerns about code duplication between webhook and workflow execution tasks, potential inconsistencies in error handling patterns, and untested status mentioned in PR description
• Files apps/sim/trigger/webhook-execution.ts and apps/sim/app/api/webhooks/trigger/[path]/route.ts need more attention due to core execution logic changes and potential edge cases
4 files reviewed, 1 comment
…dioai#810) * improvement(webhooks): move webhook exeucution to trigger dev * remove old tests
Description
Move webhook executions to trigger dev to enable immediate acks and make it follow standard async execution path.
Type of change
How Has This Been Tested?
Screen.Recording.2025-07-28.at.1.00.51.PM.mov
Checklist:
bun run test)Security Considerations: