GoogleCloudPlatform/node-red-contrib-google-cloud

Node-Red crashes with [error] ReferenceError: OnError is not defined

gilmiz opened this issue · 4 comments

Node-Red crashes when using the PubSub node to publish and subscribe for messages

Terminal message is:

[error] ReferenceError: OnError is not defined
at Subscription.OnClose (/home/nnn/.node-red/node_modules/node-red-contrib-google-cloud/pubsub-in.js:110:54)
at Subscription.emit (node:events:520:28)
at Subscriber. (/home/nnn/.node-red/node_modules/@google-cloud/pubsub/src/subscription.ts:320:32)
at Subscriber.emit (node:events:520:28)
at ModAckQueue.flush (/home/nnn/.node-red/node_modules/@google-cloud/pubsub/src/message-queues.ts:144:24)

Testing with a simple flow like
image
image

The problem appeared sometime within the last month.

I've tried reinstalling, without any change.

Did anyone else experience the same?

/Gilad

Hi there,

I got the same error.
Maybe the same thing happened to you.

I was simulating an internet connection break by turning off the wifi on my laptop and this error appeared about 5 mins after that. This is kind of a problem for me as I am deploying in a Raspberry pi and the internet connection is a mobile connection so I do expect the internet to go down from time to time.

If anyone has solved this issue or has any suggestions, it would be greatly appreciated.

Howdy chums ... am on it today!! Thanks for raising the issue. Stay tuned.

I was actually looking through the code.
The issue should be just that the function OnError does not exist. It should be OnClose instead.

I believe that it should be
subscription.removeListener('error', OnClose);

Ty @gylim78 ... I made the change ... committed to GutHub, published to npm and refreshed at Node-RED

If you could check it out when you can, that would be appreciated.