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

[Hue] Suddenly can't connect to Bridge #9301

Closed
ikupenov opened this issue Nov 17, 2023 · 4 comments
Closed

[Hue] Suddenly can't connect to Bridge #9301

ikupenov opened this issue Nov 17, 2023 · 4 comments
Labels
bug Something isn't working extension: hue Issues related to the hue extension extension Issues related to one of the extensions in the Store

Comments

@ikupenov
Copy link
Contributor

ikupenov commented Nov 17, 2023

Extension

https://www.raycast.com/pindab0ter/hue

Description

I've been using this extension for some time and never had any issues. However, today when I tried to control my lights, a connection to the Bridge couldn't be established so I tried disconnecting and reconnecting. When I tried to reconnect to the Hue bridge I got the following error: TypeError [ERR_INVALID_IP_ADDRESS]: Invalid IP address: undefined. I also tried manually setting the IP of my Bridge (and disabling DHCP) in the extension's settings, but again, no luck. I disabled my VPN and everything else I thought might interfere with the network too. I am using MacOS Sonoma 14.1.1 if that's relevant.

Steps To Reproduce

  1. Open the Control Lights command
  2. Try to connect to Hue Bridge
@ikupenov ikupenov added bug Something isn't working extension Issues related to one of the extensions in the Store labels Nov 17, 2023
@raycastbot raycastbot added the extension: hue Issues related to the hue extension label Nov 17, 2023
@raycastbot
Copy link
Collaborator

raycastbot commented Nov 17, 2023

Thank you for opening this issue!

🔔 @pindab0ter @thomaspaulmann @robertvanhoesel you might want to have a look.

💡 Author and Contributors commands

The author and contributors of pindab0ter/hue can trigger bot actions by commenting:

  • @raycastbot close this issue Closes the issue.
  • @raycastbot rename this issue to "Awesome new title" Renames the issue.
  • @raycastbot reopen this issue Reopen the issue.

@ac3xx
Copy link

ac3xx commented Nov 18, 2023

I've also been experiencing this so I thought I'd dig in to work out what's going on - with the caveat I'm not a JS dev by trade.

Whilst the docs recommend any Node.js version from 16 onwards, versions >= 20 have different networking behaviour which leads to incorrect error handling on some cases on .lookup calls. This still hasn't been looked at upstream.

Forking the extension and making the following change instantly fixed all of the issues I was having. I used the latest version of Node.js available via nvm (21.2.0). I've verified this doesn't break anything on 16.20.2 either.

Happy to submit a PR if this seems reasonable.

diff --git a/src/lib/createHueClient.ts b/src/lib/createHueClient.ts
index 78ddc58..cb4b495 100644
--- a/src/lib/createHueClient.ts
+++ b/src/lib/createHueClient.ts
@@ -58,7 +58,7 @@ export default async function createHueClient(
       lookup: (hostname, options, callback) => {
         if (hostname.toLowerCase() === bridgeConfig.id && bridgeConfig.ipAddress !== undefined) {
           // Resolve the Bridge ID to the IP address of the Hue Bridge
-          callback(null, bridgeConfig.ipAddress, 4);
+          callback(null, [{ address: bridgeConfig.ipAddress, family: 4 }]);
         } else {
           // Fallback to the default DNS lookup
           dns.lookup(hostname, options, callback);

@pindab0ter
Copy link
Contributor

Thank you for looking into it. Always appreciated!

I'm experiencing the same issue and if you change fixes it I would approve it as soon as I could test it.

So yes, please do submit it as a PR if you like!

@ikupenov
Copy link
Contributor Author

Seems that this has been fixed by #9337. Thank you both!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working extension: hue Issues related to the hue extension extension Issues related to one of the extensions in the Store
Projects
None yet
Development

No branches or pull requests

4 participants