Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventSocket Exception on Stream Enabled "null" Value #328

Open
wooliet opened this issue Oct 31, 2016 · 4 comments
Open

EventSocket Exception on Stream Enabled "null" Value #328

wooliet opened this issue Oct 31, 2016 · 4 comments

Comments

@wooliet
Copy link
Contributor

wooliet commented Oct 31, 2016

zetta/lib/event_socket.js

EventSocket.prototype.send = function(topic, data) {
  if (!Buffer.isBuffer(data) && typeof data === 'object') {
    var tmpData = (this.streamEnabled) ? data.data : data;

    if (tmpData['transitions']) {

Error: "Cannot read property 'transitions' of null"

I have a monitorable property "delay" that is typically a decrementing number. It can be set to null though, and when it does, the above exception occurs (while events socket is open).

@wooliet
Copy link
Contributor Author

wooliet commented Nov 1, 2016

TypeError: Cannot read property 'transitions' of null
    at EventSocket.send (/Users/me/Projects/zettaproj/node_modules/zetta/lib/event_socket.js:190:16)
    at EventBroker._publishStreamEnabledClient (/Users/me/Projects/zettaproj/node_modules/zetta/lib/event_broker.js:208:10)
    at /Users/me/Projects/zettaproj/node_modules/zetta/lib/event_broker.js:284:16
    at EventBroker._subscribe.handler (/Users/me/Projects/zettaproj/node_modules/zetta/lib/event_broker.js:106:5)
    at PubSub._onCallback (/Users/me/Projects/zettaproj/node_modules/zetta/lib/pubsub_service.js:102:3)
    at EventEmitter.PubSub.subscribe.f (/Users/me/Projects/zettaproj/node_modules/zetta/lib/pubsub_service.js:44:14)
    at EventEmitter.emit (events.js:129:20)
    at PubSub.publish (/Users/me/Projects/zettaproj/node_modules/zetta/lib/pubsub_service.js:32:16)
    at ObjectStream._write (/Users/me/Projects/zettaproj/service/node_modules/zetta-device/node_modules/zetta-streams/object_stream.js:16:18)
    at doWrite (_stream_writable.js:301:12)

@AdamMagaluk
Copy link
Collaborator

Thanks @wooliet i found the error and should have a fix by end of day.

What do you expect the client to see when the value goes null?

@wooliet
Copy link
Contributor Author

wooliet commented Nov 1, 2016

null I suppose. Is that not an expected use case?

@AdamMagaluk
Copy link
Collaborator

I've published a pre release with this fix in it. You can install it with [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants