-
Notifications
You must be signed in to change notification settings - Fork 3.2k
improvement(webhooks): lifecycle management with external providers, remove save configuration #2831
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
base: staging
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR improves webhook lifecycle management by moving webhook creation from a manual "Save Configuration" button to the automated deploy process, and removes the deprecated save configuration UI. Key Changes:
Issues Found:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant DeployModal
participant DeployAPI
participant WebhookDeploy
participant ProviderAPI
participant Database
User->>DeployModal: Click "Deploy"
DeployModal->>DeployAPI: POST /api/workflows/{id}/deploy
DeployAPI->>WebhookDeploy: saveTriggerWebhooksForDeploy()
loop For each trigger block
WebhookDeploy->>WebhookDeploy: resolveTriggerId()
WebhookDeploy->>WebhookDeploy: buildProviderConfig()
WebhookDeploy->>WebhookDeploy: Validate required fields
alt Has credentialSetId
WebhookDeploy->>WebhookDeploy: syncCredentialSetWebhooks()
WebhookDeploy->>Database: Fan out webhooks for credential set
else Has credentialId
WebhookDeploy->>Database: Check existing webhook
alt Webhook exists & needs recreation
WebhookDeploy->>ProviderAPI: cleanupExternalWebhook()
ProviderAPI-->>WebhookDeploy: Cleaned up
WebhookDeploy->>ProviderAPI: createExternalWebhookSubscription()
ProviderAPI-->>WebhookDeploy: External ID
end
WebhookDeploy->>Database: Upsert webhook record
alt Provider is Gmail/Outlook
WebhookDeploy->>ProviderAPI: configurePolling()
end
end
alt Error occurs
WebhookDeploy-->>DeployAPI: Return error
DeployAPI-->>DeployModal: Show error in UI
DeployModal-->>User: Display error message
end
end
WebhookDeploy-->>DeployAPI: Success
DeployAPI->>DeployAPI: deployWorkflow()
DeployAPI-->>DeployModal: Deployment complete
DeployModal-->>User: Show success
|
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.
17 files reviewed, 1 comment
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.
17 files reviewed, 1 comment
| // Block still exists - check if it was edited | ||
| const newBlock = filteredBlocks[prevBlock.id] | ||
| const prevData = prevBlock.data as Record<string, unknown> | null | ||
| if (prevData && JSON.stringify(prevData) !== JSON.stringify(newBlock)) { |
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.
logic: Comparing blocks with JSON.stringify will trigger webhook cleanup on every save, even for trivial changes like reordering object keys or whitespace differences. Any edit to a trigger block will delete and require re-creation of webhooks during next deploy, causing unnecessary churn.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/app/api/workflows/[id]/state/route.ts
Line: 212:212
Comment:
**logic:** Comparing blocks with `JSON.stringify` will trigger webhook cleanup on every save, even for trivial changes like reordering object keys or whitespace differences. Any edit to a trigger block will delete and require re-creation of webhooks during next deploy, causing unnecessary churn.
How can I resolve this? If you propose a fix, please make it concise.
Summary
Will do webhook lifecycle management as part of deploy process.
Type of Change
Testing
Tested manually
Checklist