question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Streaming API Errors

See original GitHub issue

Hi 👋 ,

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:open
  • Created 3 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

1reaction
khontarau-coverwalletcommented, Nov 18, 2020

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.

0reactions
luizfernandowcommented, Mar 30, 2021

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:

const replayExt = new StreamingExtension.Replay(topicName, replayId);
client.addExtension(replayExt);
const subscription = client.subscribe(topicName, messageHandler);
try {
  await subscription;
} catch (error) {
  console.log(error);
}

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handling Streaming API Errors - Salesforce Developers
Handling Streaming API Errors · 401 Authentication Errors · 403 Unknown Client Error · 403 Resource Limit and Validation Errors for Handshake Requests...
Read more >
YouTube Live Streaming API - Errors - Google Developers
This document identifies the different types of errors that YouTube Live Streaming API operations can return. You can also find a list of ......
Read more >
Streaming API Error: 403::Handshake denied - Google Groups
I have a very simple pipeline running that has an origin of Salesforce and a destination of ElasticSearch. For the most part, it...
Read more >
API Error Codes - Node chat - GetStream.io
400. Bad Request. 18. Event is not supported ; 400. Bad Request. 19. The feature is currently disabled on the dashboard (i.e. Reactions...
Read more >
Common Errors - Amazon Kinesis Data Streams Service
This section lists the errors common to the API actions of all AWS services. For errors specific to an API action for this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found