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

homebridge-wink causes homebridge to crash if wink API is unavailable. #16

Closed
msroest opened this issue Jan 11, 2016 · 11 comments
Closed

Comments

@msroest
Copy link
Contributor

msroest commented Jan 11, 2016

[Wink] Refreshing Wink Data
response in http:



<style type="text/css">
html, body, iframe { margin: 0; padding: 0; height: 100%; }
iframe { display: block; width: 100%; border: none; }
</style>
<title>Application Error</title>


<iframe src="//s3.amazonaws.com/heroku_pages/error.html">

Application Error


</iframe>


SyntaxError: Unexpected token <
at Object.parse (native)
at IncomingMessage. (/usr/lib/node_modules/homebridge-wink/node_modules/wink-js/index.js:67:19)
at emitNone (events.js:72:20)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:905:12)
at nextTickCallbackWith2Args (node.js:478:9)
at process._tickCallback (node.js:392:17)
raw message



<style type="text/css">
html, body, iframe { margin: 0; padding: 0; height: 100%; }
iframe { display: block; width: 100%; border: none; }
</style>
<title>Application Error</title>


<iframe src="//s3.amazonaws.com/heroku_pages/error.html">

Application Error


</iframe>


/usr/lib/node_modules/homebridge-wink/node_modules/wink-js/index.js:223
for( var dataIndex in data.data ) {
^

TypeError: Cannot read property 'data' of undefined
at /usr/lib/node_modules/homebridge-wink/node_modules/wink-js/index.js:223:41
at IncomingMessage. (/usr/lib/node_modules/homebridge-wink/node_modules/wink-js/index.js:74:7)
at emitNone (events.js:72:20)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:905:12)
at nextTickCallbackWith2Args (node.js:478:9)
at process._tickCallback (node.js:392:17)

@msroest
Copy link
Contributor Author

msroest commented Jan 14, 2016

Looking at the stack trace closer this actually seems to be an issue with wink-js. I'm working on a branch to handle the exception out of wink-js

@msroest
Copy link
Contributor Author

msroest commented Jan 14, 2016

I've created a PR in winfinit/wink-js#4 for fixing the underlying issue in wink-js. I need to spend more time learning the node.js async error handling to see how to handle this on the homebridge-wink side if the wink-js issue doesn't get fixed.

@pdlove
Copy link
Contributor

pdlove commented Jan 14, 2016

Thank you. Looks like wink-js needs a new npm publish as well. The one on the wink-js github fixes the issue of the huge data dump to the console by putting it into a debug output instead of console.

@msroest
Copy link
Contributor Author

msroest commented Jan 14, 2016

Yah I asked in the issue we'll see if he gets it out.

@pdlove
Copy link
Contributor

pdlove commented Jan 14, 2016

Looks like the npm module has been updated. I think you just need to run "npm update" on homebridge?

@msroest
Copy link
Contributor Author

msroest commented Jan 15, 2016

Nope an update doesn't work. the packages.json is defining ^0.0.9. The wink-js update was done as version 0.1.0 and so it doesn't update to it. I've open a PR to fix this we'll need a new release though.

@msroest
Copy link
Contributor Author

msroest commented Jan 15, 2016

Well according to https://www.npmjs.com/package/semver the ^0.1.0 will get be 0.1.0 <= ver < 0.2.0 I guess it depends on how @winfinit is planning on versioning wink-js. Based on the semver info ^0.1.0 is correct as 0.1.x should guarantee no breaking api changes where >0.1.0 things could break as a 0.2.0 could have a incompatible API change.

@pdlove
Copy link
Contributor

pdlove commented Jan 15, 2016

That makes a lot more sense. Thanks for that explanation.

@winfinit
Copy link

Although I am not fully complying to "semver", however I do strongly agree with "semver" summary:

  • MAJOR version when you make incompatible API changes
  • MINOR version when you add functionality in a backwards-compatible manner
  • PATCH version when you make backwards-compatible bug fixes

so you can feel safe to update MINOR version.

msroest added a commit to msroest/homebridge-wink that referenced this issue Jan 15, 2016
msroest added a commit to msroest/homebridge-wink that referenced this issue Jan 15, 2016
@msroest
Copy link
Contributor Author

msroest commented Jan 15, 2016

Great thanks @winfinit so I'll update it to be 0.1.0 < ver < 1.0.0 then.

@KraigM
Copy link
Owner

KraigM commented Jan 16, 2016

Released in 1.0.3

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

4 participants