I am trying to connect to salesforce using PubSub API communication in order to receive events from SF, I am using the following project example: https://github.com/pozil/pub-sub-api-node-client. Everything was working fine, however, when we started trying to connect from a previous replay id we started to receive some errors.

Reading the documentation it indicates that for subscribing from a replay id we need to specify the replay preset and the replay id.

The replay option consists of a combination of replay_preset and replay_id values in the first FetchRequest received from a client.

So what we have done is add to the subscribe requests those 2 new options

const subscribeRequest = {

    // new options for connecting from the replay id
    replayId: "12907414",
    replayPreset: 2

However, now we are receiving an error


Checking the documentation, this error says:

The Replay ID validation failed. Ensure that the replay_id field value in FetchRequest is valid and refers to an event that is within the retention window.

But we know that this replay id is valid because if we use it with the previous communication (comentD) everything is working and also this event was sent on the same day.

Do you have some idea what could be happening?

  • Sounds like a bug on SF side, open a case with Support.
    – identigral
    Commented Nov 8, 2022 at 16:56
  • We have opened a case however the reply was that we don't have that support from SF because we have a standard plan that does not come with developer support
    – Albert
    Commented Nov 9, 2022 at 8:32
  • Sure, will do it, thanks!
    – Albert
    Commented Nov 10, 2022 at 15:39

1 Answer 1


In the end was an issue with the encoding of the replay id, reference: https://github.com/pozil/pub-sub-api-node-client/issues/4

  • Thank you for following up and posting the solution, upvoted. Minor "issue": it would be preferable to include the essential parts of the answer here, and provide the link for reference.
    – identigral
    Commented Nov 16, 2022 at 15:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .