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

Failed to activate stream #1286

Closed
1 task done
Dr4Eyez opened this issue Aug 9, 2023 · 41 comments
Closed
1 task done

Failed to activate stream #1286

Dr4Eyez opened this issue Aug 9, 2023 · 41 comments
Labels
live-streaming Problems with live streams

Comments

@Dr4Eyez
Copy link

Dr4Eyez commented Aug 9, 2023

Streaming Issue

I can receive snapshot and notifications just fine but I am unable to get a livestream to work through the home app. It works fine on the ring app. I am fairly new to home bridge and I am not sure if I missed something while setting it up. Any help would be appreciated. Thank you.

Proposed Solution

The specific cause of the error could be related to incorrect data handling, data offsets, or indices during the cryptographic operations. However, I am unsure and am requesting help.

Environment

Homebridge

What operating system are you on?

Mac

Relevant log output

[8/9/2023, 12:22:17 AM] [Ring] Activating stream for Front Door (0.482s)
[8/9/2023, 12:22:17 AM] [Ring] WebSocket connected for Front Door
[8/9/2023, 12:22:18 AM] [Ring] iceConnectionStateChange: completed
[8/9/2023, 12:22:18 AM] [Ring] RangeError: offset is out of bounds
    at Uint8Array.set (<anonymous>)
    at Function.padStart (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:972:13)
    at Function.encodeSignature (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:940:22)
    at Function.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/webcrypto/build/webcrypto.js:1575:54)
    at EcdsaProvider.onSign (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/webcrypto/build/webcrypto.js:1737:25)
    at EcdsaProvider.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:157:28)
    at SubtleCrypto.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:1405:39)
    at Function.create (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/x509/build/x509.cjs.js:2407:35)
    at Function.value [as createSelfSignedCertificateWithKey] (/usr/local/lib/node_modules/homebridge-ring/node_modules/dtls/src/context/cipher.ts:108:18)
    at RTCDtlsTransport.setupCertificate (/usr/local/lib/node_modules/homebridge-ring/node_modules/werift/src/transport/dtls.ts:76:9)
[8/9/2023, 12:22:18 AM] [Ring] Failed to activate stream
[8/9/2023, 12:22:18 AM] [Ring] RangeError: offset is out of bounds
    at Uint8Array.set (<anonymous>)
    at Function.padStart (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:972:13)
    at Function.encodeSignature (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:940:22)
    at Function.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/webcrypto/build/webcrypto.js:1575:54)
    at EcdsaProvider.onSign (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/webcrypto/build/webcrypto.js:1737:25)
    at EcdsaProvider.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:157:28)
    at SubtleCrypto.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:1405:39)
    at Function.create (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/x509/build/x509.cjs.js:2407:35)
    at Function.value [as createSelfSignedCertificateWithKey] (/usr/local/lib/node_modules/homebridge-ring/node_modules/dtls/src/context/cipher.ts:108:18)
    at RTCDtlsTransport.setupCertificate (/usr/local/lib/node_modules/homebridge-ring/node_modules/werift/src/transport/dtls.ts:76:9)
[8/9/2023, 12:22:18 AM] [Ring] connectionStateChange: closed
[8/9/2023, 12:22:18 AM] [Ring] iceConnectionStateChange: closed
[8/9/2023, 12:22:18 AM] [Ring] Call ended before answered
[8/9/2023, 12:27:31 AM] [Homebridge UI] [homebridge-ring] Terminating child process...
[8/9/2023, 12:27:31 AM] [Homebridge UI] [homebridge-ring] Child process ended

Honesty Time

  • I swear this is worth your time!
@Dr4Eyez Dr4Eyez added the live-streaming Problems with live streams label Aug 9, 2023
@DerMuri
Copy link

DerMuri commented Aug 9, 2023

I have the exact same issue.
Are you also using the v12 beta of the plugin?

@Dr4Eyez
Copy link
Author

Dr4Eyez commented Aug 9, 2023

@DerMuri I am using homebridge-ring v11.8.1

I have the exact same issue.
Are you also using the v12 beta of the plugin?

@tsightler
Copy link
Collaborator

This is a strange issue as it appears at first glance to be unrelated to any of the recent changes in ring-homebridge/ring-client-api, which is further confirmed by the fact that users are having it with v11.8.1 as well. It looks like some kind of dependency conflict with some downstream package as I'm not sure why the standalone dtls package is installed.

Unfortunately, I'm travelling this week and won't have any chance to dig into it until sometime early next week.

@DerMuri
Copy link

DerMuri commented Aug 10, 2023

This is a strange issue as it appears at first glance to be unrelated to any of the recent changes in ring-homebridge/ring-client-api, which is further confirmed by the fact that users are having it with v11.8.1 as well. It looks like some kind of dependency conflict with some downstream package as I'm not sure why the standalone dtls package is installed.

Unfortunately, I'm travelling this week and won't have any chance to dig into it until sometime early next week.

No hurry. Thanks for addressing the issue.

Your work is much appreciated.

@F-Kafka
Copy link

F-Kafka commented Aug 11, 2023

FYI, I too am having this issue. It began when I updated to version 11.8.1. If it helps here's the log when opening a stream.

[11/08/2023, 09:11:27] [Ring] Preparing Live Stream for Front Door
[11/08/2023, 09:11:27] [Ring] Stream Prepared for Front Door (0.379s)
[11/08/2023, 09:11:28] [Ring] Activating stream for Front Door (0.467s)
[11/08/2023, 09:11:30] [Ring] iceConnectionStateChange: completed
[11/08/2023, 09:11:30] [Ring] RangeError: offset is out of bounds
at Uint8Array.set ()
at Function.padStart (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:972:13)
at Function.encodeSignature (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:940:22)
at Function.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/webcrypto/build/webcrypto.js:1575:54)
at EcdsaProvider.onSign (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/webcrypto/build/webcrypto.js:1737:25)
at EcdsaProvider.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:157:28)
at SubtleCrypto.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:1405:39)
at Function.create (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/x509/build/x509.cjs.js:2407:35)
at Function.value [as createSelfSignedCertificateWithKey] (/usr/local/lib/node_modules/homebridge-ring/node_modules/dtls/src/context/cipher.ts:108:18)
at RTCDtlsTransport.setupCertificate (/usr/local/lib/node_modules/homebridge-ring/node_modules/werift/src/transport/dtls.ts:76:9)
[11/08/2023, 09:11:30] [Ring] connectionStateChange: closed
[11/08/2023, 09:11:30] [Ring] iceConnectionStateChange: closed
[11/08/2023, 09:11:30] [Ring] Failed to activate stream
[11/08/2023, 09:11:30] [Ring] RangeError: offset is out of bounds
at Uint8Array.set ()
at Function.padStart (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:972:13)
at Function.encodeSignature (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:940:22)
at Function.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/webcrypto/build/webcrypto.js:1575:54)
at EcdsaProvider.onSign (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/webcrypto/build/webcrypto.js:1737:25)
at EcdsaProvider.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:157:28)
at SubtleCrypto.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:1405:39)
at Function.create (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/x509/build/x509.cjs.js:2407:35)
at Function.value [as createSelfSignedCertificateWithKey] (/usr/local/lib/node_modules/homebridge-ring/node_modules/dtls/src/context/cipher.ts:108:18)
at RTCDtlsTransport.setupCertificate (/usr/local/lib/node_modules/homebridge-ring/node_modules/werift/src/transport/dtls.ts:76:9)

@teacherguy2020
Copy link

I have similar logs as well

@dgreif
Copy link
Owner

dgreif commented Aug 13, 2023

Seeing a lot of reports of this, including some in the Google Nest homebridge plugin. I agree with @tsightler that it's likely a dependency (or sub dependency) that changed, but I don't have any specific ideas on which one at this point.

I have not been able to reproduce this myself yet. For those who are experience it, could you provide the following info:

  • Node.js version
  • homebridge-ring version
  • Camera model experiencing issues
  • iOS/TvOS version, including both iPhone and home hub (AppleTV, HomePod, etc)

This should hopefully help us narrow down the cause.

@DerMuri
Copy link

DerMuri commented Aug 13, 2023

Hi thanks for looking into it.

Nods.js: v18.17.1
Homebridge v1.6.1
Ring plugin is 12.0 beta
I am using the Ring Video Doorbell (2nd generation)

@F-Kafka
Copy link

F-Kafka commented Aug 13, 2023

Thanks for investigating this.

Node.js version: 18.17.1
Homebridge version: 1.6.1
Homebridge Ring Plugin version: 11.8.1
Camera: Peephole Cam

@shaileshck
Copy link

Seeing a lot of reports of this, including some in the Google Nest homebridge plugin. I agree with @tsightler that it's likely a dependency (or sub dependency) that changed, but I don't have any specific ideas on which one at this point.

I have not been able to reproduce this myself yet. For those who are experience it, could you provide the following info:

  • Node.js version
  • homebridge-ring version
  • Camera model experiencing issues

This should hopefully help us narrow down the cause.

Node.js version: 18.17.1
Homebridge version: 1.6.1
Homebridge Ring Plugin version: v12.0 tried downgrading to 11.8.1 as well it’s same.
Camera: Ring Doorbell Pro 1st Gen

Thanks

@doncarajo
Copy link

Me too. Recently upgraded to latest NodeJS version v18.17.1.

@cebrakadabra
Copy link

cebrakadabra commented Aug 14, 2023

Seeing a lot of reports of this, including some in the Google Nest homebridge plugin. I agree with @tsightler that it's likely a dependency (or sub dependency) that changed, but I don't have any specific ideas on which one at this point.

I have not been able to reproduce this myself yet. For those who are experience it, could you provide the following info:

  • Node.js version
  • homebridge-ring version
  • Camera model experiencing issues

This should hopefully help us narrow down the cause.

Node.js version: v18.17.1
Homebridge version: 1.6.1
Homebridge ring plugin version: homebridge-ring v11.8.1
Ring Doorbell: Video Doorbell 3
Ring Stick up Cam(s): 3rd Gen

The iat (time issued) of the refresh token of the ring plugin was:
1687123720 (Sun Jun 18th 2023) - which i refreshed and re-enabled the account connection which for seconds "healed" all the stick up cams with a poster picture (stream placeholder) which I tried to then re-connect for the live-stream and this error came up in the logs:

[13/08/2023, 21:46:45] [Ring] Preparing Live Stream for Garden Tree
[13/08/2023, 21:46:46] [Ring] Stream Prepared for Garden Tree (0.399s)
[13/08/2023, 21:46:46] [Ring] Activating stream for Garden Tree (0.446s)
[13/08/2023, 21:46:47] [Ring] iceConnectionStateChange: completed
[13/08/2023, 21:46:47] [Ring] Failed to activate stream
[13/08/2023, 21:46:47] [Ring] RangeError: offset is out of bounds
    at Uint8Array.set (<anonymous>)
    at Function.padStart (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:972:13)
    at Function.encodeSignature (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:940:22)
    at Function.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/webcrypto/build/webcrypto.js:1575:54)
    at EcdsaProvider.onSign (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/webcrypto/build/webcrypto.js:1737:25)
    at EcdsaProvider.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:157:28)
    at SubtleCrypto.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:1405:39)
    at Function.create (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/x509/build/x509.cjs.js:2407:35)
    at Function.value [as createSelfSignedCertificateWithKey] (/usr/local/lib/node_modules/homebridge-ring/node_modules/dtls/src/context/cipher.ts:108:18)
    at RTCDtlsTransport.setupCertificate (/usr/local/lib/node_modules/homebridge-ring/node_modules/werift/src/transport/dtls.ts:76:9)
    at ensureCert (/usr/local/lib/node_modules/homebridge-ring/node_modules/werift/src/peerConnection.ts:1293:34)
    at RTCPeerConnection.ensureCerts (/usr/local/lib/node_modules/homebridge-ring/node_modules/werift/src/peerConnection.ts:1301:7)
    at RTCPeerConnection.createAnswer (/usr/local/lib/node_modules/homebridge-ring/node_modules/werift/src/peerConnection.ts:1306:5)
    at WeriftPeerConnection.createAnswer (/usr/local/lib/node_modules/homebridge-ring/node_modules/ring-client-api/lib/streaming/peer-connection.js:121:24)
    at WebrtcConnection.handleMessage (/usr/local/lib/node_modules/homebridge-ring/node_modules/ring-client-api/lib/streaming/webrtc-connection.js:29:32)
[13/08/2023, 21:46:47] [Ring] connectionStateChange: closed
[13/08/2023, 21:46:47] [Ring] iceConnectionStateChange: closed

Hope this helps!

@cebrakadabra
Copy link

cebrakadabra commented Aug 14, 2023

Let us know if you need assistance in testing:
#1283

Shoutout to @tsightler and @dgreif ❤️

edit: I installed the beta12 version and now all snapshots are working on ring cameras - it loads longer for the livestream, but remains with the same error in a failed state - however the behavior seems to be improving

@tsightler
Copy link
Collaborator

Another thing that might be interesting, what other plugins are installed (if any) and what is the iOS version in use.

@DerMuri
Copy link

DerMuri commented Aug 14, 2023

  • Homebridge is running on macOS Monterey
  • The other plugins are: Homebridge Hue, Homebridge Xiaomi Fan
  • The issue appears regardless where I try to open the stream. I am on Sonoma beta, iOS 17 Beta, tvOS 17 beta. I haven't tested it on a non-beta OS, yet.

@shaileshck
Copy link

shaileshck commented Aug 14, 2023 via email

@tsightler

This comment was marked as outdated.

@cebrakadabra

This comment was marked as outdated.

@tsightler

This comment was marked as outdated.

@cebrakadabra

This comment was marked as outdated.

@tsightler

This comment was marked as outdated.

@cebrakadabra

This comment was marked as outdated.

@ruudbol

This comment was marked as resolved.

@tsightler
Copy link
Collaborator

tsightler commented Aug 15, 2023

Thanks everyone that has provided npm output. I have hidden them for now to make the thread more readable but they were extremely useful. Going through the details the only difference I could find between my working setup and the non-working ones was the version of pvtsutils. My working setup was using 1.3.2 while the broken ones above have 1.3.3, and sure enough, updating my version to 1.3.3 reproduces the issue.

Also, v1.3.3 was updated 8 days ago and a very similar issue with the padStart function has already been reported on the pvtsutils project page: PeculiarVentures/pvtsutils#12

Manually reverting the package back to pvtsutils v1.3.2 solves the issue which is the workaround for now.

@dgreif
Copy link
Owner

dgreif commented Aug 15, 2023

Thank you for the thorough investigation work @tsightler!

I just released 12.0.0-beta.1, which should "pin" the pvtsutils version to 1.3.2. I say "should" because I'm seeing some funky behavior with npm workspaces locally, but the actual install doesn't use workspaces. Let us know if the beta version works for y'all!

@cebrakadabra
Copy link

@dgreif appreciate the effort and release! - I tried and it didn't update it within homebridge-ring my pvtsutils is still set to 1.3.3 as part of the package.json within the node_modules of homebridge-ring

Unfortunately the npm install log disappears to quickly in the homebridge ui to tell.
It might only will do so, if I'd remove homebridge-ring completely and re-install.

@tsightler
Copy link
Collaborator

One of the most confusing things for me is that I just did my Homebridge install fresh last night and I only received pvtsutils 1.3.2, even though 1.3.3 was available. I had to manually update to 1.3.3 to get it.

@dgreif
Copy link
Owner

dgreif commented Aug 15, 2023

Thanks for the quick response @cebrakadabra. Give 12.0.0-beta.2 a try 🤞.

For context, it looks like there is an npm bug where it doesn't respect the override field after a dep has already been installed 😞. I switched to listing 1.3.2 as a direct dependency, which seems to fix it on my end, but curious how it goes for other users.

@dgreif
Copy link
Owner

dgreif commented Aug 15, 2023

@tsightler npm can be weird that way. It has a local cache that it checks first, so if you had previously installed 1.3.2, it would see that and say "this version satisfies my needs" and just use that. I'm guessing that's what happened

@cebrakadabra
Copy link

Thanks for the quick response @cebrakadabra. Give 12.0.0-beta.2 a try 🤞.

For context, it looks like there is an npm bug where it doesn't respect the override field after a dep has already been installed 😞. I switched to listing 1.3.2 as a direct dependency, which seems to fix it on my end, but curious how it goes for other users.

@dgreif @tsightler

  1. Using 12.0.0-beta.2
  2. restarted the homebridge server
  3. confirming i see 1.3.2
  4. and a working live stream 🥳

Thank you! ❤️

@DerMuri
Copy link

DerMuri commented Aug 15, 2023

Thanks for the quick response @cebrakadabra. Give 12.0.0-beta.2 a try 🤞.

For context, it looks like there is an npm bug where it doesn't respect the override field after a dep has already been installed 😞. I switched to listing 1.3.2 as a direct dependency, which seems to fix it on my end, but curious how it goes for other users.

It works! Thanks so much!

@F-Kafka
Copy link

F-Kafka commented Aug 15, 2023

Thanks everyone for contributing and working on this. I can confirm upgrading to 12.0 beta 2 installed pvtsutils 1.3.2 & resolved the problem.

@reesek
Copy link

reesek commented Aug 15, 2023

Thank you all SO much for your amazing help with this! I can also confirm that v12.0.0-beta.2 resolved the issues with live streaming!

@kjp10480
Copy link

Hi Everyone. Can someone give guidance on how to manually upgrade?
I am running Homebridge 1.6.1 on a windows pc.
Thanks,
KJ

@shaileshck
Copy link

shaileshck commented Aug 16, 2023 via email

@teacherguy2020
Copy link

Any idea of when it will move out of beta and become available through the Homebridge interface? Thanks very much

@ruudbol
Copy link

ruudbol commented Aug 16, 2023

Thx, working again

@tsightler
Copy link
Collaborator

Any idea of when it will move out of beta and become available through the Homebridge interface? Thanks very much

The beta should be installable via the Homebridge UI even now, that's how I did it. Just select install alternate version and select the v12.0.0-beta.2 version from the drop down list.

@teacherguy2020
Copy link

Perfect, thank you…. works great

@kjp10480
Copy link

Any idea of when it will move out of beta and become available through the Homebridge interface? Thanks very much

The beta should be installable via the Homebridge UI even now, that's how I did it. Just select install alternate version and select the v12.0.0-beta.2 version from the drop down list.

Thank you!!!!!!

@dgreif
Copy link
Owner

dgreif commented Aug 17, 2023

Looks like all positive feedback flowing in, so I'm going to go ahead and close + lock this issue. I'll probably cut an official release in the next week or so.

@dgreif dgreif closed this as completed Aug 17, 2023
Repository owner locked as resolved and limited conversation to collaborators Aug 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
live-streaming Problems with live streams
Projects
None yet
Development

No branches or pull requests