-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Prevent SmartSuite webhooks from expiring #14386
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
WalkthroughThe changes in this pull request include updates to the version numbers of several components within the Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
components/smartsuite/sources/common/base.mjs (1)
Line range hint
89-108
: Consider adding error handling for webhook events listing.The
run()
method should include error handling for the API call to ensure robustness of the webhook renewal mechanism.async run() { const hookId = this._getHookId(); const pageToken = this._getPageToken(); - const { - events, next_page_token: nextPageToken, - } = await this.smartsuite.listWebhookEvents({ - data: { - webhook_id: hookId, - page_token: pageToken, - }, - }); + try { + const { + events, next_page_token: nextPageToken, + } = await this.smartsuite.listWebhookEvents({ + data: { + webhook_id: hookId, + page_token: pageToken, + }, + }); - this._setPageToken(nextPageToken); + this._setPageToken(nextPageToken); - if (!events?.length) { - return; - } + if (!events?.length) { + return; + } - events.forEach((event) => { - const meta = this.generateMeta(event); - this.$emit(event, meta); - }); + events.forEach((event) => { + const meta = this.generateMeta(event); + this.$emit(event, meta); + }); + } catch (error) { + console.error('Failed to list webhook events:', error); + throw error; + } },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (4)
- components/smartsuite/package.json (1 hunks)
- components/smartsuite/sources/common/base.mjs (1 hunks)
- components/smartsuite/sources/new-record-created-instant/new-record-created-instant.mjs (1 hunks)
- components/smartsuite/sources/record-updated-instant/record-updated-instant.mjs (1 hunks)
✅ Files skipped from review due to trivial changes (2)
- components/smartsuite/package.json
- components/smartsuite/sources/record-updated-instant/record-updated-instant.mjs
🧰 Additional context used
🔇 Additional comments (3)
components/smartsuite/sources/new-record-created-instant/new-record-created-instant.mjs (2)
9-9
: LGTM! Version bump is appropriate.The version increment from 0.0.1 to 0.0.2 is appropriate for adding webhook renewal functionality.
Line range hint
1-21
: Verify timer configuration inheritance.The component inherits from the common base which should include the new timer configuration for webhook renewal. Let's verify this implementation:
✅ Verification successful
Let me try to verify this with a corrected path and additional search strategies.
Timer configuration is properly inherited from base component
The verification confirms that:
- The base component (
components/smartsuite/sources/common/base.mjs
) includes the timer configuration for webhook renewal- The timer is configured to run daily (every 24 hours)
- The component under review correctly inherits this configuration through the spread operator (
...common
)- No conflicting timer implementations were found in the smartsuite component
The implementation is correct and no changes are needed.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the timer configuration in base.mjs # Expected: Should find timer configuration for webhook renewal # Check the base.mjs file for timer configuration echo "Checking base.mjs for timer configuration:" rg -A 10 "timer.*=" "../common/base.mjs" # Verify there are no other timer implementations that might conflict echo -e "\nChecking for any conflicting timer implementations:" rg "timer.*=" "components/smartsuite/"Length of output: 352
Script:
#!/bin/bash # First, let's find the correct path to base.mjs echo "Finding base.mjs location:" fd "base.mjs" components/smartsuite/ echo -e "\nChecking content of base.mjs for timer configuration:" fd "base.mjs" components/smartsuite/ --exec cat {} echo -e "\nChecking for any timer-related configurations in the smartsuite component:" rg -A 5 "timer" components/smartsuite/Length of output: 3896
components/smartsuite/sources/common/base.mjs (1)
8-15
: Verify webhook renewal implementation.The timer is described as being for "webhook renewal", but the
run()
method only lists webhook events. While this prevents expiration by satisfying the "listing payloads" requirement, it might be worth adding explicit webhook renewal logic if the SmartSuite API provides such an endpoint.Also applies to: 89-108
✅ Verification successful
Let me try another search strategy to locate the relevant files and understand the webhook implementation.
Let me try one more time with corrected commands to examine the SmartSuite implementation.
Let me check the implementation of the base source to understand how the timer and webhook events are handled.
Based on the examination of the SmartSuite implementation, I can now provide the final response:
The webhook implementation is correct and doesn't require explicit renewal
The current implementation is actually well-designed and maintains webhook activity through two mechanisms:
- The daily timer triggers
listWebhookEvents()
calls, which keeps the webhook active by satisfying SmartSuite's activity requirements- The webhook itself is properly managed through:
- Creation with proper configuration in
activate()
- Storage of webhook ID in the database
- Cleanup in
deactivate()
The timer's description is accurate - it maintains webhook activity through regular event listing, which is a common pattern for keeping webhooks alive. No explicit renewal endpoint is needed as the SmartSuite API considers webhooks active as long as events are being retrieved.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check if there's a dedicated webhook renewal endpoint in the SmartSuite API client # Look for any renewal-related methods in the SmartSuite app file rg -i "renew|refresh" "../../smartsuite.app.mjs" # Look for any update webhook methods that might be used for renewal ast-grep --pattern 'updateWebhook'Length of output: 309
Script:
#!/bin/bash # Search for the SmartSuite app file and webhook-related code fd -e mjs -e js smartsuite # Look for webhook-related code in SmartSuite files rg -i "webhook" --type js --type mjs -A 5 -B 5 components/smartsuite/Length of output: 167
Script:
#!/bin/bash # Examine the SmartSuite app file content cat components/smartsuite/smartsuite.app.mjs # Look for webhook-related code in SmartSuite files rg -i "webhook" components/smartsuite/ --type-add 'js:*.{js,mjs}' --type jsLength of output: 5274
Script:
#!/bin/bash # Check the base source implementation cat components/smartsuite/sources/common/base.mjsLength of output: 2653
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.
LGTM!
Resolves #14384
Summary by CodeRabbit
New Features
timer
property for webhook renewal scheduling, enhancing configuration options.Version Updates
@pipedream/smartsuite
package from 0.1.0 to 0.1.1.new-record-created-instant
module from 0.0.1 to 0.0.2.record-updated-instant
module from 0.0.1 to 0.0.2.