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.

Subscription protocol response message can be received after a message

See original GitHub issue

When I remove the first line it works.

const nats = require('nats').connect()
const natsStreaming = require('node-nats-streaming').connect('test-cluster', 'test')


natsStreaming.on('connect', function () {

  natsStreaming.publish('foo', 'Hello node-nats-streaming!', function (err, aGuid) {
    console.log('Error publishing: ' + aGuid + ' - ' + err)
  })

  // Subscriber can specify how many existing messages to get.
  var opts = natsStreaming.subscriptionOptions().setStartWithLastReceived();
  var subscription = natsStreaming.subscribe('foo', opts);
  subscription.on('message', function (msg) {
    console.log('Received a message [' + msg.getSequence() + '] ' + msg.getData());
  })

})

Error:

E:\Repositorys\hemera>node examples\full-example.js
Received a message [9] Hello node-nats-streaming!

events.js:160
      throw er; // Unhandled 'error' event
      ^
Error
    at Client.publish (E:\Repositorys\hemera\node_modules\nats\lib\nats.js:1019:13)
    at Message.ack (E:\Repositorys\hemera\node_modules\node-nats-streaming\lib\stan.js:748:24)
    at Message.maybeAutoAck (E:\Repositorys\hemera\node_modules\node-nats-streaming\lib\stan.js:735:10)
    at Object.callback (E:\Repositorys\hemera\node_modules\node-nats-streaming\lib\stan.js:634:11)
    at Client.processMsg (E:\Repositorys\hemera\node_modules\nats\lib\nats.js:954:11)
    at Client.processInbound (E:\Repositorys\hemera\node_modules\nats\lib\nats.js:882:14)
    at Socket.<anonymous> (E:\Repositorys\hemera\node_modules\nats\lib\nats.js:465:12)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
aricartcommented, Jan 31, 2017

The PR will get you going until we determine how/if the server needs to be fixed.

0reactions
StarpTechcommented, Feb 1, 2017

I will try it asap thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Subscription protocol response message can be received ...
What we know: the on message is getting processed before the subscription is ready. There's a 'ready' notification for the subscription, which ...
Read more >
Subscribe - Amazon Simple Notification Service
Messages that can't be delivered due to client errors (for example, when the subscribed endpoint is unreachable) or server errors (for example, when...
Read more >
RFC 3265 SIP-Specific Event Notification - IETF
Non-200 class final responses indicate that no subscription or dialog has been created, and no subsequent NOTIFY message will be sent.
Read more >
Make sure your endpoint is ready to process Amazon SNS ...
Make sure that your code can handle message delivery retries from Amazon SNS. If Amazon SNS doesn't receive a successful response from your...
Read more >
Pull subscriptions | Cloud Pub/Sub Documentation
The Pub/Sub pull subscription can use one of the following two APIs for retrieving messages: Pull; StreamingPull.
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