Skip to content

Publishing from outside platform - Inexact CreatedById causes event not to fire triggers or flows #42

@gaelguimini

Description

@gaelguimini

Hi,

When non-salesforce platform publishers publish Platform Events through the PubSub API, they are required to meet the Schema of the platform event.
This also includes two fields that are generally not provided by salesforce platform publishers (apex, flows, etc) :

  • CreateDate : appears to be ignored, and the Event bus handles the timestamping.
  • CreateById : MUST match the id of user authenticated to the pubsub api

Failing to do that :

  1. Message is accepted by the pubsub API and returns a replay ID
  2. No automation (Platform event Flow or Platform event trigger) are triggered. Nor is any log provided to help trouble shoot

This is a follow up to issue pozil/pub-sub-api-node-client#17
This was also discussed with support in case 500Hx00000K444jIAB (#45348057)

Steps to reproduce

  1. Create a new platform event, no custom field required
  2. Add a simple Platform Event Trigger (that only throws an exception) or Platform event Flow (that only causes) on this platform event
  3. Enable finest debug log on the intergration user
  4. Implement any client outside salesforce platform using any language (i went for Node using @pozil 's https://github.com/pozil/pub-sub-api-node-client/)
  5. Publish a platform event with CreatedById=WHATEVER as the intergration user

Observed Outcome

The pubsub api provides the client with a replay id
NO Executition of the trigger nor flow (no log generated for the interview nor Code Unit)

Expected outcome (Strict)

The pubsub api rejects the message with error Invalid user Id : Must match the Id of Authenticated user or something along the way

Expected outcome (devFriendly)

The pubsub accepts the message, but overrides the value provided in CreatedById to match user posting the platform event through pubsub api
The flow and trigger execute without issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions