I am trying to subscribe to a platform event in salesforce and it works fine - except ability to replay events -either from a specific replayId or from the earliest available (-2). Below is the code that I am using - which is taken from a sample code provided in a salesforce doc but is not working - any help would be greatly appreciated.
`org.authenticate({ username: USERNAME, password: PASSWORD,securityToken: SECURITY_TOKEN }, function(err, oauth) {
if(err) return console.log("Error authenticating to Salesforce, " + err);
var client = org.createStreamClient();
REPLAY_ID = -2;
console.log("Latest REPLAY_ID - ", REPLAY_ID);
}
});
var accs = client.subscribe({topic:TOPIC, isEvent:true, **retry: -2**});`
I have also tried using "replayId" and "replayFrom" instead of retry but still no good. I am running this code from AWS Lambda - Node JS .