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 stops without emitting an error

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Reactions:8
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
kevinohara80commented, Jan 21, 2019

@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.

1reaction
kevinohara80commented, Jan 21, 2019

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:

I also have the same issue. I used the forked ’ https://github.com/crimson-education/nforce’ instead using this. and my implementation also looks like this. no messages are received after some time but the connection is still there. so curious.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kevinohara80/nforce/issues/168#issuecomment-456042338, or mute the thread https://github.com/notifications/unsubscribe-auth/AAigQLcX7m1Mj8G0XoMogj3VLjQGYGGvks5vFaSfgaJpZM4aKQB0 .

Kevin O’Hara | tw:kevohara https://twitter.com/kevohara | github: kevinohara80 https://github.com/kevinohara80

Read more comments on GitHub >

github_iconTop 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 >

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