Skip to content

Conversation

@jcortes
Copy link
Collaborator

@jcortes jcortes commented Nov 6, 2025

WHY

Resolves #18929

Summary by CodeRabbit

  • Chores
    • Updated Salesforce REST API package version to 1.10.1
    • Bumped versions for multiple Salesforce event source components (new-case, new-email-template, new-knowledge-article, new-record sources)

@jcortes jcortes self-assigned this Nov 6, 2025
@vercel
Copy link

vercel bot commented Nov 6, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
pipedream-docs Ignored Ignored Nov 6, 2025 9:21pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Nov 6, 2025 9:21pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 6, 2025

Walkthrough

This pull request fixes an event format inconsistency in the Salesforce REST API component's "New Record" trigger. The deploy() hook now emits historical events in the same format as real-time webhook events by removing the "New" wrapper and "UserId" field. Component and source versions are incremented accordingly.

Changes

Cohort / File(s) Summary
Package version bump
components/salesforce_rest_api/package.json
Version updated from 1.10.0 to 1.10.1
Deploy hook event format fix
components/salesforce_rest_api/sources/common/common-new-record.mjs
Modified deploy() to emit events with body containing object directly (no "New" wrapper, no "UserId" field). Updated generateWebhookMeta() to read fields directly from data.body instead of destructuring via New property.
Source component version bumps
components/salesforce_rest_api/sources/new-case-instant/new-case-instant.mjs, components/salesforce_rest_api/sources/new-email-template-instant/new-email-template-instant.mjs, components/salesforce_rest_api/sources/new-knowledge-article-instant/new-knowledge-article-instant.mjs
Version updated from 0.0.5 to 0.0.6
Source component version bump
components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs
Version updated from 0.2.5 to 0.2.6

Sequence Diagram(s)

sequenceDiagram
    participant Deploy as Deploy Hook
    participant ProcessEvent as Process Webhook
    participant Metadata as Generate Metadata
    participant User as Downstream Consumer

    rect rgb(240, 248, 255)
    Note over Deploy,User: Historical Behavior (Before Fix)
    Deploy->>ProcessEvent: event.body = { New: object, UserId: id }
    ProcessEvent->>Metadata: data.body.New
    Metadata->>Metadata: destructure { New: newObject }
    Metadata->>User: metadata (works)
    end

    rect rgb(200, 230, 201)
    Note over Deploy,User: Real-time Behavior (Always)
    Deploy->>ProcessEvent: Webhook: event.body = object (direct)
    ProcessEvent->>Metadata: data.body (no New wrapper)
    Metadata->>Metadata: X fails - expects New property
    Metadata->>User: metadata (broken)
    end

    rect rgb(200, 230, 201)
    Note over Deploy,User: Unified Behavior (After Fix)
    Deploy->>ProcessEvent: event.body = object (direct)
    ProcessEvent->>Metadata: data.body (no New wrapper)
    Metadata->>Metadata: read fields directly from data.body
    Metadata->>User: metadata (works consistently)
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Most changes are straightforward version bumps across multiple files (repetitive pattern requiring minimal review)
  • The core logic change in common-new-record.mjs is focused and well-scoped: event payload structure is simplified and metadata extraction logic is adjusted correspondingly to match the change
  • All changes align with a single, clear objective to fix event format inconsistency

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: fixing the inconsistency in event format between deploy-time and real-time events for Salesforce triggers.
Description check ✅ Passed The description references the linked issue #18929 but lacks detail on the changes made; the template appears minimal with only a WHY section.
Linked Issues check ✅ Passed The PR successfully implements Option 1 from issue #18929: removes the 'New' wrapper from deploy() and updates generateWebhookMeta() to read directly from data.body, making historical and real-time events consistent.
Out of Scope Changes check ✅ Passed All changes directly address the inconsistency issue: common-new-record.mjs fixes the core problem, version bumps in source files reflect the fix, and package.json version bump tracks the component release.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-salesforce-inconsistent-event-format-between-deploy-time-and-real-time-events

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aebf7b0 and e20c322.

📒 Files selected for processing (6)
  • components/salesforce_rest_api/package.json (1 hunks)
  • components/salesforce_rest_api/sources/common/common-new-record.mjs (2 hunks)
  • components/salesforce_rest_api/sources/new-case-instant/new-case-instant.mjs (1 hunks)
  • components/salesforce_rest_api/sources/new-email-template-instant/new-email-template-instant.mjs (1 hunks)
  • components/salesforce_rest_api/sources/new-knowledge-article-instant/new-knowledge-article-instant.mjs (1 hunks)
  • components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2024-07-24T02:06:47.016Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-07-24T02:06:47.016Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.

Applied to files:

  • components/salesforce_rest_api/sources/common/common-new-record.mjs
📚 Learning: 2025-10-20T01:01:02.970Z
Learnt from: js07
Repo: PipedreamHQ/pipedream PR: 18744
File: components/slack_v2/actions/send-large-message/send-large-message.mjs:49-64
Timestamp: 2025-10-20T01:01:02.970Z
Learning: In components/slack_v2/actions/send-large-message/send-large-message.mjs, the metadata_event_payload prop is typed as string, so the code only needs to handle string-to-JSON parsing and does not need to handle object inputs.

Applied to files:

  • components/salesforce_rest_api/sources/common/common-new-record.mjs
📚 Learning: 2025-07-09T18:07:12.426Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 17538
File: components/aircall/sources/new-sms/new-sms.mjs:19-25
Timestamp: 2025-07-09T18:07:12.426Z
Learning: In Aircall API webhook payloads, the `created_at` field is returned as an ISO 8601 string format (e.g., "2020-02-18T20:52:22.000Z"), not as milliseconds since epoch. For Pipedream components, this needs to be converted to milliseconds using `Date.parse()` before assigning to the `ts` field in `generateMeta()`.

Applied to files:

  • components/salesforce_rest_api/sources/common/common-new-record.mjs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Publish TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (6)
components/salesforce_rest_api/package.json (1)

3-3: LGTM: Appropriate version bump for bug fix.

The patch version increment from 1.10.0 to 1.10.1 correctly follows semantic versioning conventions for a bug fix release.

components/salesforce_rest_api/sources/new-email-template-instant/new-email-template-instant.mjs (1)

10-10: LGTM: Version bump reflects inherited fix.

The version increment is appropriate since this component inherits the event format fix from common-new-record.mjs.

components/salesforce_rest_api/sources/new-knowledge-article-instant/new-knowledge-article-instant.mjs (1)

10-10: LGTM: Version bump reflects inherited fix.

The version increment is appropriate since this component inherits the event format fix from common-new-record.mjs.

components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs (1)

9-9: LGTM: Version bump reflects inherited fix.

The version increment is appropriate since this component inherits the event format fix from common-new-record.mjs.

components/salesforce_rest_api/sources/new-case-instant/new-case-instant.mjs (1)

10-10: LGTM: Version bump reflects inherited fix.

The version increment is appropriate since this component inherits the event format fix from common-new-record.mjs.

components/salesforce_rest_api/sources/common/common-new-record.mjs (1)

77-83: LGTM: Correctly updated to read directly from data.body.

The method now correctly extracts CreatedDate, Id, and the name field directly from data.body instead of from data.body.New, matching the new consistent event format.

Copy link
Collaborator

@michelle0927 michelle0927 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@vunguyenhung
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Salesforce 'New Object' trigger: Inconsistent event format between deploy-time and real-time events

4 participants