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

GetDevices hangs on M1 Mac #539

Closed
tylervsd opened this issue Jan 1, 2021 · 6 comments
Closed

GetDevices hangs on M1 Mac #539

tylervsd opened this issue Jan 1, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@tylervsd
Copy link

tylervsd commented Jan 1, 2021

Bug Report

Describe the Bug

When running the ring-client-api on M1 Mac, the client appears to hang on the getDevices call (sample program below). I realize my environment is not common, and would be happy to help debug as needed.

To Reproduce

I first saw this issue when running homebridge, then was able to reproduce in a standalone script. Note that I am not a Node js developer so the code below is rough:

Script:

import  { RingApi }  from '/opt/homebrew/Cellar/node/15.5.0/node_modules/ring-client-api/lib/api/api.js';

const ringApi = new RingApi({
  refreshToken: 'ABC123',
	debug: true

});
console.log('Initialized Ring API');
const locations =  await ringApi.getLocations();
const allCameras = await ringApi.getCameras()

console.log(
    `Found ${locations.length} location(s) with ${allCameras.length} camera(s).`
)

const    location = locations[0];
//location is logged properly
console.log(location);
const devices = await location.getDevices()
//Code never makes it here
console.log('Got Devices');

From stepping into the code, the following area of ring-client-api location.js is what appears to never return:

return new Promise((resolve, reject) => {
                connection.once('connect', () => {
                    resolve(connection);
                    this.onConnected.next(true);
                    util_1.logInfo('Ring connected to socket.io server');
                    assets.forEach((asset) => this.requestList(deviceListMessageType, asset.uuid));
                });
                connection.once('error', reject);
            }).catch(reconnect);

Expected behavior

Expect the list of devices to be returned

Screenshots/Logs

NA

Additional context

I have homebridge-ring running fine on a Raspberry Pi, so I don't feel this is specific to my network

Environment

I installed node/npm using the ARM HomeBrew build for the M1 Mac.

  • OS: MacOS 11.1
  • Node.js: 15.5.0
  • NPM: 7.3.0
  • ring-client-api: 9.12.8
@tylervsd tylervsd added the bug Something isn't working label Jan 1, 2021
@dgreif
Copy link
Owner

dgreif commented Jan 1, 2021

Thanks for providing all the info in the issue template! You are on Node 15, which causes the issue you are seeing. If you install the latest node 14, it should work just fine.

@tylervsd
Copy link
Author

tylervsd commented Jan 1, 2021

Thank you so much for the prompt reply. Good to hear this is a known issue. I will install node14

@dgreif
Copy link
Owner

dgreif commented Jan 3, 2021

@tylervsd any luck?

@tylervsd
Copy link
Author

tylervsd commented Jan 3, 2021

@dgreif - Thank you for the follow-up. Unfortunately it does not look like Node 14 will be supported natively on the M1 ( nodejs/node#36161 ).

In the meantime I have kept the ring client running on my Raspberry Pi (where it works great). I didn't want to manage side-by-side Intel and ARM Node installs on my M1 :)

I have also found another homebridge plugin with a similar issue, so it is not just the ring plugin that is impacted.

For my own knowledge, is this issue due to a bug in Node15, or was a breaking change introduced in Node 15?

Thanks again!

@tylervsd tylervsd closed this as completed Jan 3, 2021
@dgreif
Copy link
Owner

dgreif commented Jan 3, 2021

@tylervsd good to know that node 14 isn't compatible on M1! Running it on an rpi is definitely the easiest option, and has the most support since that's how most users have theirs set up.

I'm not exactly sure why node 15 isn't working, but the main observation is that the socket.io-client fails to connect to Rings server if you are using node 15. I haven't found any issues on that package related to node 15. Might be something that gets figured out eventually, but for now it's safer to just use node 14 which is their current LTS version.

@tylervsd
Copy link
Author

tylervsd commented Jan 3, 2021 via email

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

2 participants