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

Failing to connect to ring API #1536

Closed
1 task done
RickySett opened this issue Nov 22, 2024 · 3 comments
Closed
1 task done

Failing to connect to ring API #1536

RickySett opened this issue Nov 22, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@RickySett
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe The Bug

I enter my ring credentials and get a token. However when the plugin attempts to start i get this error:
[11/21/2024, 2:50:22 PM] [homebridge-ring] Retry #xx failed to reach Ring server at https://api.ring.com/devices/v1/locations. Error: fetch failed, Cause: invalid connection header, Code: UND_ERR_INVALID_ARG. Trying again in 5 seconds...
This goes on and on every 5 seconds unless i stop the plugin.

To Reproduce

No response

Expected behavior

The plugin is not showing any devices and doesn't seem to even connect to the service.

Relevant log output

No response

Screenshots

No response

Homebridge Ring Config

{
            "refreshToken": "Omitted for security",
            "_bridge": {
                "username": "Omitted for security",
                "port": 42724
            },
            "platform": "Ring"
        }

Additional context

No response

OS

Windows

Node.js Version

v18.13.0

NPM Version

8.19.3

Homebridge/HOOBs Version

v1.8.5

Homebridge Ring Plugin Version

13.2.0

Operating System

Windows Hyper-v

@RickySett RickySett added the bug Something isn't working label Nov 22, 2024
@tsightler
Copy link
Collaborator

Unfortunately, I think this is my fault. I submitted a PR that added "Connection: close" header to try to hint Ring API servers to close connection to work around the fetch hanging issues in prior versions, and this was included in 13.2.0 release. What I did not know was that, at least on some older versions of undici, it explicitly blocks this header and returns an error.

I've already submitted PR #1532 which removes the header and uses a different approach for connection handling which appears to address the previous hang issue as well.

That being said, your NodeJS version is quite old (nearly 2 years) and had a very early version of fetch/undici with many, many known issues. I can't reproduce this issue with current versions of Node 20/22, so perhaps try upgrading to a more current version. The latest NodeJS LTS version is always recommended as that is the versions that is most tested. Currently LTS is 22.11.0.

@lnlyssg
Copy link

lnlyssg commented Nov 23, 2024

I was also experiencing this but updating node has fixed it for me

@tsightler
Copy link
Collaborator

Also, we have released 13.2.1-beta which should resolve this issue. Please feel free to test and report back. Based on the fact that upgrading Node should fix this, and that a fix is already queued for the next release, I'm going to close this now, however, if for some reason neither of these two fixes address the issue, please feel free to post here and we can re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants