peter-murray / node-hue-api

Node.js Library for interacting with the Philips Hue Bridge and Lights
Apache License 2.0
1.18k stars 144 forks source link

Error: Problems resolving hue bridges, unable to get local issuer certificate #208

Closed odedd closed 2 years ago

odedd commented 2 years ago

Hi.

I'm using a program called bitfocus companion to control my hue lights. It's done using a node module called 'companion-module-phillips-hue' (git here) which uses node-hue-api v4.0.9. This used to work great for several months. Several days ago, without anything I can recall doing, it stopped connecting to the hue bridge. Please notice that my iphone app still manages to connect just fine.

I'm a beginner in the world of node.js (to say the least), but from looking at the logs, I see the following error message: Problems resolving hue bridges, unable to get local issuer certificate. It seems to come from the node-hue-api side of things.

I'm running macos 11.6.2 (big sur). I've tried factory resetting my hue bridge but to no avail.

Any idea what might be causing that? Is that something on my system or a widespread issue?

Thank you very much

LordTocs commented 2 years ago

It's a problem in this library, I encountered it with my application last night. The certificate is hard coded in https://github.com/peter-murray/node-hue-api/blob/main/lib/api/discovery/ca-chain.js which seems to no longer work. https://discovery.meethue.com/ got a new cert on the 4th and it looks like it only goes to April. It's not on your machine thankfully but that companion-module-phillips-hue will need updating.

I worked around it by just running the request to https://discovery.meethue.com/ myself instead of using the library function. Hopefully Peter makes a fix. :)

timothystewart6 commented 2 years ago

I just started experiencing this myself.

Problems resolving hue bridges, unable to get local issuer certificate

Happy to help if I can

timothystewart6 commented 2 years ago

I was able to get the new cert chain by running openssl s_client -showcerts -connect discovery.meethue.com:443 </dev/null

I attempted a fix here https://github.com/timothystewart6/node-hue-api/blob/fix-ca-chain/lib/api/discovery/ca-chain.js however I am still getting the same error. I am sure it's something simple but not sure. I will open a PR if I figure it out.

odedd commented 2 years ago

The third part of your cert chain was not correct. I just made a PR with the correct one.

timothystewart6 commented 2 years ago

Thank you @odedd ! Did you get the cert from running that same command?

timothystewart6 commented 2 years ago

closed by https://github.com/peter-murray/node-hue-api/pull/209

odedd commented 2 years ago

Thank you @odedd ! Did you get the cert from running that same command?

I got it via the browser (firefox), looked at the cert and downloaded the cert chain pem file.

peter-murray commented 2 years ago

Resolved in releases 4.0.11 and 5.0.0-beta.10