-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat(attachments): use filesystem for gmail, outlook triggers to save attachments #1631
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 GitHub. |
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 Overview
Summary
Adds filesystem-based attachment handling for Gmail and Outlook triggers/blocks. Attachments are downloaded from email APIs and uploaded to execution storage using a new WebhookAttachmentProcessor utility class.
Key changes:
- New
WebhookAttachmentProcessorclass handles attachment upload to execution storage - Gmail and Outlook triggers now support
includeAttachmentsconfiguration option - Gmail and Outlook blocks (read operations) support
includeAttachmentsparameter - Attachments are converted to
UserFileobjects for workflow consumption - Deploy API no longer auto-generates API keys - requires user to provide one
- Fixed subblock subscription bug in
workflow-block.tsx
Critical Issue:
The polling services create temporary execution IDs when storing attachments, which may prevent workflow executions from accessing these attachments since the execution ID won't match.
Confidence Score: 2/5
- This PR has a critical logic issue with temporary execution IDs that will likely prevent attachments from being accessible
- The temporary executionId created during polling (line 564 in gmail-polling-service.ts and line 379 in outlook-polling-service.ts) won't match the actual workflow execution ID, breaking the attachment access flow. Additionally, the deploy route changes removing API key auto-generation could be a breaking change for existing users.
- Pay close attention to
apps/sim/lib/webhooks/gmail-polling-service.tsandapps/sim/lib/webhooks/outlook-polling-service.ts- the temporary executionId logic needs to be addressed
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/lib/webhooks/attachment-processor.ts | 5/5 | New utility class for processing webhook attachments, uploading them to execution storage, with proper error handling |
| apps/sim/lib/webhooks/gmail-polling-service.ts | 4/5 | Added attachment download and processing for Gmail triggers using new attachment processor |
| apps/sim/lib/webhooks/outlook-polling-service.ts | 4/5 | Added attachment download and processing for Outlook triggers with new downloadOutlookAttachments function |
| apps/sim/app/api/workflows/[id]/deploy/route.ts | 3/5 | Removed auto-generation of API keys, now requires user to provide one - potential breaking change |
Sequence Diagram
sequenceDiagram
participant User
participant Trigger as Gmail/Outlook Trigger
participant PollingService as Polling Service
participant EmailAPI as Email API (Gmail/Outlook)
participant AttachmentProcessor as WebhookAttachmentProcessor
participant Storage as Execution File Storage
participant Workflow as Workflow Execution
User->>Trigger: Configure includeAttachments=true
Trigger->>PollingService: Poll for new emails
PollingService->>EmailAPI: Fetch new emails
EmailAPI-->>PollingService: Return email list
alt includeAttachments enabled
PollingService->>EmailAPI: Download attachments
EmailAPI-->>PollingService: Return attachment data (Buffer)
PollingService->>PollingService: Create temporary executionId
PollingService->>AttachmentProcessor: processAttachments()
AttachmentProcessor->>Storage: uploadExecutionFile()
Storage-->>AttachmentProcessor: Return UserFile objects
AttachmentProcessor-->>PollingService: Return processed attachments
end
PollingService->>Workflow: Trigger workflow with email + attachments
Workflow->>Storage: Access attachment files via UserFile URLs
Storage-->>Workflow: Serve attachment data
11 files reviewed, 2 comments
… attachments (#1631) * feat(outlook): add include attachment feature to outlook * add include attachments to gmail trigger * add gmail trigger, outlook block include attachments * fix rendering issue * remove comment * fix architecture * fix redeploy * pass files to logging session to surface in logs * fix gmail block parsing attachments * fix reads
Summary
Type of Change
Testing
Tested manually
Checklist