Streaming stops without emitting an error
See original GitHub issueI am using the current version of nforce library with the modifications of replayId
from crimson-education. The client works for some time and stops getting new events from Salesforce without emitting any errors. Below here is how I have implemented the streaming client.
Could you help find what I did wrong?
const params = {
clientId: CLIENT_ID,
clientSecret: CLIENT_SECRET,
redirectUri: CALLBACK_URL + '/oauth/_callback',
mode: 'single',
environment: ENVIRONMENT,
apiVersion: 'v41.0',
autoRefresh: true,
replayId: -1
};
const connection = nforce.createConnection(params);
const userInfo = { username: USERNAME, password: PASSWORD };
const oauth = await connection.authenticate(userInfo);
const params = { topic, oauth, replayId };
const client = await connection.createStreamClient();
const stream = await client.subscribe(params);
stream.on('connect', onConnectHandler);
stream.on('error', onErrorHandler);
stream.on('data', onDataHandler);
Above is the minimalistic code that explains my order of execution. CC: @kevinohara80
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Error Events Don't Inherently Stop Streams In Node.js
To demonstrate, we can emit errors in both Readable and Writable streams and continue to use them without issue.
Read more >Why does emitting an error in a destination stream unpipe it?
I believe the idea is to prevent data loss. In other words if there is a problem with the destination stream, stop pushing...
Read more >How to stop stream without putting down the Nodejs server
First, don't throw an error from your error event handler. Any time an exception is uncaught, the node process will crash.
Read more >How to handle stream errors? - Mario Kandut
The most important event emitted by a stream is the error event. If this error event is not handled, it can crash your...
Read more >When Try-Catch Doesn't Catch Errors in Node.js |
The answer to this question is that stream is a subclass of EventEmitter object, which is using an asynchronous callback. Hmm, but what...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@erangahn I’m going to close this only because it appears to be the same as #131. This has been a long-running issue with the Faye client.
Keep an eye on that issue as I’m going to be working on a fix. If you feel that this issue is different somehow, feel free to re-open it.
Ok, I’m going to look into it this week.
On Mon, Jan 21, 2019 at 6:29 AM Koli@k notifications@github.com wrote:
–
Kevin O’Hara | tw:kevohara https://twitter.com/kevohara | github: kevinohara80 https://github.com/kevinohara80