Streaming API Errors
See original GitHub issueHi 👋 ,
We’re about to go into production with the Streaming API using the replay id extension and have found an issue.
We store the last processed event id in our database, and when reconnecting we use it to get all events since. We have just had a scenario where the last processed item was more than 24 hours old, so is no longer available to use as a replay id - but instead of throwing an error it silently continues to run, but the subscription isn’t valid - new items aren’t being received.
It would be good if there was a way of choosing the behaviour for error cases listed https://developer.salesforce.com/docs/atlas.en-us.api_streaming.meta/api_streaming/streaming_error_codes.htm, which includes The replayId {replay_id} you provided was invalid. Please provide a valid ID, -2 to replay all events, or -1 to replay only new events.
We’ve worked around the original issue by saving a datetime and reverting to use -2 as the event id, but it’d be good to have more visibility of the errors.
Sam
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5
Top GitHub Comments
Hello guys! Having same issue. According the jsforce code everything looks ok, it seems like connection is established and everything is ok, but the new events are just not coming in this case. I assume this might be an issue on SF event bus side, since the only thing jsforce/faye do is passing the replayId at subscription - after that, no communication / configuration can be done.
So I assume the expected behavior is just SF continue push the messages event if the subscription has expired replayId. Does anybody reached SF support? Will try to push it forward a bit.
The best workaround that I am thinking about now, is to store last replayId and it’s creation date in the app level, and have a periodic check that there is no 24 hours passed - and if so - resubscribe with -2 replay id to retrieve all data.
Hi people,
Here I’m able to get the error message:
400::The replayId {576368} you provided was invalid. Please provide a valid ID, -2 to replay all events, or -1 to replay only new events.
With the example bellow:But I was facing another problem with the replayId, the client was receiving a
403::Unknown client
error. The Faye client handles this error and subscribe again to the topics, the problem is that some topics stays more than 72h without receiving a message and in this process the invalid replayId is used. Also the Faye client don’t catch the error in their handler, like I did in the example above.For solve this problem at moment I created another extension to handle this scenario. Do you think that the
StreamingExtension.Replay
should handles this scenario?