-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[TRIGGER] Use Webhooks for Vercel Sources #16570
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 ↗︎ 3 Skipped Deployments
|
WalkthroughThis update introduces webhook-based event sources for Vercel integration, adding shared modules for event constants and webhook handling, and implementing new instant event sources for deployment lifecycle events. The package version is incremented, new dependencies are added, and minor version bumps are applied to existing actions and sources. The app's team option mapping is also enhanced. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Source (e.g. New Deployment Instant)
participant Webhook Base
participant Vercel API
participant Database
User->>Source: Activate source
Source->>Webhook Base: activate()
Webhook Base->>Vercel API: createWebhook(events, endpoint, ...)
Vercel API-->>Webhook Base: webhookId, webhookSecret
Webhook Base->>Database: Store webhookId, webhookSecret
Vercel API-->>Source: Send webhook event (HTTP POST)
Source->>Webhook Base: run({body, headers, bodyRaw})
Webhook Base->>Database: Retrieve webhookSecret
Webhook Base->>Webhook Base: Validate signature
Webhook Base->>Source: processResource(resource)
Source->>User: Emit event with metadata
User->>Source: Deactivate source
Source->>Webhook Base: deactivate()
Webhook Base->>Database: Retrieve webhookId
Webhook Base->>Vercel API: deleteWebhook(webhookId)
Assessment against linked issues
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
components/vercel_token_auth/actions/cancel-deployment/cancel-deployment.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/vercel_token_auth/actions/create-deployment/create-deployment.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/vercel_token_auth/actions/list-deployments/list-deployments.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. 📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (13)
🚧 Files skipped from review as they are similar to previous changes (10)
🧰 Additional context used🪛 GitHub Check: Lint Code Basecomponents/vercel_token_auth/sources/deployment-canceled-instant/deployment-canceled-instant.mjs[warning] 7-7: components/vercel_token_auth/sources/deployment-error-instant/deployment-error-instant.mjs[warning] 7-7: components/vercel_token_auth/sources/deployment-succeeded-instant/deployment-succeeded-instant.mjs[warning] 7-7: ⏰ Context from checks skipped due to timeout of 90000ms (3)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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: 8
🔭 Outside diff range comments (1)
components/vercel_token_auth/sources/deployment-canceled-instant/deployment-canceled-instant.mjs (1)
4-28
: 🛠️ Refactor suggestionSource name should start with "New" per Pipedream guidelines.
The static analysis tool flagged that source names should start with "New" according to Pipedream guidelines (https://pipedream.com/docs/components/guidelines/#source-name).
Update the source name to follow the guideline:
- name: "Deployment Canceled (Instant)", + name: "New Deployment Canceled",The rest of the implementation looks solid, with good separation of concerns, proper extension of the common webhook base, and clear metadata generation.
🧰 Tools
🪛 GitHub Check: Lint Code Base
[warning] 7-7:
Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
🧹 Nitpick comments (2)
components/vercel_token_auth/sources/common/events.mjs (1)
1-45
: Centralized event constants need clarification for naming variations.Centralizing event constants is good practice for consistency. However, there are duplicate-looking events with different formats:
- Some use dot notation (e.g.,
DEPLOYMENT_READY: "deployment.ready"
)- Others use hyphens (e.g.,
DEPLOYMENT_READY_: "deployment-ready"
)This could cause confusion for developers.
Consider adding comments to explain the reason for these variations, such as:
export default { + // Standard webhook event types using dot notation BUDGET_REACHED: "budget.reached", BUDGET_RESET: "budget.reset", // ... other dot notation events ... + // Alternative event format using hyphens (explain why these exist) DEPLOYMENT_CHECKS_COMPLETED: "deployment-checks-completed", DEPLOYMENT_READY_: "deployment-ready", // ... other hyphenated events ... };components/vercel_token_auth/sources/common/webhook.mjs (1)
136-147
: Nit: spelling & code readability
incommingSignature
→incomingSignature
(twice). Purely cosmetic but aids comprehension.- const incommingSignature = headers["x-vercel-signature"]; + const incomingSignature = headers["x-vercel-signature"]; ... - const isValid = this.isSignatureValid(incommingSignature, bodyRaw); + const isValid = this.isSignatureValid(incomingSignature, bodyRaw);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (14)
components/vercel_token_auth/actions/cancel-deployment/cancel-deployment.mjs
(1 hunks)components/vercel_token_auth/actions/create-deployment/create-deployment.mjs
(1 hunks)components/vercel_token_auth/actions/list-deployments/list-deployments.mjs
(1 hunks)components/vercel_token_auth/common/constants.mjs
(1 hunks)components/vercel_token_auth/package.json
(2 hunks)components/vercel_token_auth/sources/common/events.mjs
(1 hunks)components/vercel_token_auth/sources/common/webhook.mjs
(1 hunks)components/vercel_token_auth/sources/deployment-canceled-instant/deployment-canceled-instant.mjs
(1 hunks)components/vercel_token_auth/sources/deployment-error-instant/deployment-error-instant.mjs
(1 hunks)components/vercel_token_auth/sources/deployment-ready-instant/deployment-ready-instant.mjs
(1 hunks)components/vercel_token_auth/sources/deployment-succeeded-instant/deployment-succeeded-instant.mjs
(1 hunks)components/vercel_token_auth/sources/new-deployment-instant/new-deployment-instant.mjs
(1 hunks)components/vercel_token_auth/sources/new-deployment/new-deployment.mjs
(1 hunks)components/vercel_token_auth/vercel_token_auth.app.mjs
(1 hunks)
🧰 Additional context used
🪛 GitHub Check: Lint Code Base
components/vercel_token_auth/sources/deployment-canceled-instant/deployment-canceled-instant.mjs
[warning] 7-7:
Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
components/vercel_token_auth/sources/deployment-error-instant/deployment-error-instant.mjs
[warning] 7-7:
Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
components/vercel_token_auth/sources/deployment-succeeded-instant/deployment-succeeded-instant.mjs
[warning] 7-7:
Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
components/vercel_token_auth/sources/deployment-ready-instant/deployment-ready-instant.mjs
[warning] 7-7:
Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Verify TypeScript components
- GitHub Check: pnpm publish
- GitHub Check: Publish TypeScript components
🔇 Additional comments (8)
components/vercel_token_auth/package.json (2)
3-3
: Confirm semantic version bump
The version has been updated from0.0.5
to0.1.0
, which aligns with adding new webhook-based event sources and major feature enhancements. This increment appropriately reflects the introduction of new functionality.
16-17
: Verify necessity of npmcrypto
dependency
Node.js provides a built-incrypto
module. Please confirm that you require the npmcrypto
package (^1.0.1
) rather than the core module—if the built-in API suffices, consider removing the extra dependency to reduce bundle size.components/vercel_token_auth/actions/list-deployments/list-deployments.mjs (1)
7-7
: Consistent version bump
Version has been updated from0.0.4
to0.0.5
to stay in sync with the package’s new0.1.0
release. No functional changes detected—this is purely a metadata update.components/vercel_token_auth/sources/new-deployment/new-deployment.mjs (1)
8-8
: Consistent version bump
The source version was bumped from0.0.4
to0.0.5
, matching the coordinated release across actions and other sources. No other modifications; looks good.components/vercel_token_auth/actions/cancel-deployment/cancel-deployment.mjs (1)
7-7
: Consistent version bump
Updated the action version from0.0.4
to0.0.5
in line with the overall package release. No logical changes—only metadata.components/vercel_token_auth/actions/create-deployment/create-deployment.mjs (1)
8-8
: Consistent version bump
Version incremented from0.0.4
to0.0.5
to synchronize with related modules. No code logic was altered.components/vercel_token_auth/common/constants.mjs (1)
12-13
: LGTM: Constants added for webhook identification and secret.The new constants follow the naming conventions of the file and will enable consistent reference to webhook IDs and secrets across the codebase.
components/vercel_token_auth/vercel_token_auth.app.mjs (1)
47-58
: Good improvement: Enhanced flexibility with customizable mapper function.The refactoring of the team options method to accept an optional mapper function increases the component's flexibility while maintaining backward compatibility through the default implementation.
components/vercel_token_auth/sources/deployment-error-instant/deployment-error-instant.mjs
Show resolved
Hide resolved
components/vercel_token_auth/sources/deployment-error-instant/deployment-error-instant.mjs
Show resolved
Hide resolved
...ents/vercel_token_auth/sources/deployment-succeeded-instant/deployment-succeeded-instant.mjs
Show resolved
Hide resolved
...ents/vercel_token_auth/sources/deployment-succeeded-instant/deployment-succeeded-instant.mjs
Show resolved
Hide resolved
components/vercel_token_auth/sources/deployment-ready-instant/deployment-ready-instant.mjs
Outdated
Show resolved
Hide resolved
components/vercel_token_auth/sources/deployment-ready-instant/deployment-ready-instant.mjs
Outdated
Show resolved
Hide resolved
components/vercel_token_auth/sources/new-deployment-instant/new-deployment-instant.mjs
Show resolved
Hide resolved
9b05477
to
fda2abd
Compare
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: 3
♻️ Duplicate comments (6)
components/vercel_token_auth/sources/deployment-error-instant/deployment-error-instant.mjs (2)
7-7
: 🛠️ Refactor suggestionRename the source to comply with Pipedream naming guidelines
Lint warns that source names should start with "New". Renaming avoids a pipeline failure and keeps the catalogue consistent.
- name: "Deployment Error (Instant)", + name: "New Deployment Error (Instant)",🧰 Tools
🪛 GitHub Check: Lint Code Base
[warning] 7-7:
Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
21-24
:⚠️ Potential issue
createdAt
may be undefined – fall back tocreated
Vercel's deployment payload exposes a
created
(Unix ms) field, notcreatedAt
. Referencing a non-existent property will setts
toundefined
, breaking deduping and event ordering.- ts: resource.createdAt, + ts: resource.createdAt ?? resource.created,components/vercel_token_auth/sources/deployment-succeeded-instant/deployment-succeeded-instant.mjs (2)
7-7
: 🛠️ Refactor suggestionPrefix source name with "New" to satisfy lint rules
- name: "Deployment Succeeded (Instant)", + name: "New Deployment Succeeded (Instant)",🧰 Tools
🪛 GitHub Check: Lint Code Base
[warning] 7-7:
Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
21-24
:⚠️ Potential issueGuard against missing
createdAt
in Vercel payloadSame rationale as previous files - Vercel uses
created
rather thancreatedAt
for timestamps.- ts: resource.createdAt, + ts: resource.createdAt ?? resource.created,components/vercel_token_auth/sources/deployment-ready-instant/deployment-ready-instant.mjs (2)
7-7
: 🛠️ Refactor suggestionFix lint violation: source names must begin with "New"
- name: "Deployment Ready (Instant)", + name: "New Deployment Ready (Instant)",🧰 Tools
🪛 GitHub Check: Lint Code Base
[warning] 7-7:
Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
21-24
:⚠️ Potential issueFallback when
createdAt
is absent- ts: resource.createdAt, + ts: resource.createdAt ?? resource.created,
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (14)
components/vercel_token_auth/actions/cancel-deployment/cancel-deployment.mjs
(1 hunks)components/vercel_token_auth/actions/create-deployment/create-deployment.mjs
(1 hunks)components/vercel_token_auth/actions/list-deployments/list-deployments.mjs
(1 hunks)components/vercel_token_auth/common/constants.mjs
(1 hunks)components/vercel_token_auth/package.json
(2 hunks)components/vercel_token_auth/sources/common/events.mjs
(1 hunks)components/vercel_token_auth/sources/common/webhook.mjs
(1 hunks)components/vercel_token_auth/sources/deployment-canceled-instant/deployment-canceled-instant.mjs
(1 hunks)components/vercel_token_auth/sources/deployment-error-instant/deployment-error-instant.mjs
(1 hunks)components/vercel_token_auth/sources/deployment-ready-instant/deployment-ready-instant.mjs
(1 hunks)components/vercel_token_auth/sources/deployment-succeeded-instant/deployment-succeeded-instant.mjs
(1 hunks)components/vercel_token_auth/sources/new-deployment-instant/new-deployment-instant.mjs
(1 hunks)components/vercel_token_auth/sources/new-deployment/new-deployment.mjs
(1 hunks)components/vercel_token_auth/vercel_token_auth.app.mjs
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- components/vercel_token_auth/package.json
🚧 Files skipped from review as they are similar to previous changes (9)
- components/vercel_token_auth/sources/new-deployment/new-deployment.mjs
- components/vercel_token_auth/actions/cancel-deployment/cancel-deployment.mjs
- components/vercel_token_auth/actions/create-deployment/create-deployment.mjs
- components/vercel_token_auth/actions/list-deployments/list-deployments.mjs
- components/vercel_token_auth/common/constants.mjs
- components/vercel_token_auth/sources/common/events.mjs
- components/vercel_token_auth/sources/common/webhook.mjs
- components/vercel_token_auth/sources/new-deployment-instant/new-deployment-instant.mjs
- components/vercel_token_auth/vercel_token_auth.app.mjs
🧰 Additional context used
🪛 GitHub Check: Lint Code Base
components/vercel_token_auth/sources/deployment-canceled-instant/deployment-canceled-instant.mjs
[warning] 7-7:
Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
components/vercel_token_auth/sources/deployment-error-instant/deployment-error-instant.mjs
[warning] 7-7:
Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
components/vercel_token_auth/sources/deployment-ready-instant/deployment-ready-instant.mjs
[warning] 7-7:
Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
components/vercel_token_auth/sources/deployment-succeeded-instant/deployment-succeeded-instant.mjs
[warning] 7-7:
Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Verify TypeScript components
- GitHub Check: pnpm publish
- GitHub Check: Publish TypeScript components
...onents/vercel_token_auth/sources/deployment-canceled-instant/deployment-canceled-instant.mjs
Show resolved
Hide resolved
...onents/vercel_token_auth/sources/deployment-canceled-instant/deployment-canceled-instant.mjs
Show resolved
Hide resolved
components/vercel_token_auth/sources/deployment-ready-instant/deployment-ready-instant.mjs
Outdated
Show resolved
Hide resolved
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.
Hi @jcortes, LGTM! Ready for QA!
fda2abd
to
d10ee4d
Compare
d10ee4d
to
dbf1dd4
Compare
/approve |
WHY
Resolves #16561
Summary by CodeRabbit
New Features
Improvements
Chores