Skip to content

Ignore data track promise rejections after a subscription readable stream is discarded#1917

Open
1egoman wants to merge 2 commits intomainfrom
fix-data-tracks-subscription-unhandledrejection
Open

Ignore data track promise rejections after a subscription readable stream is discarded#1917
1egoman wants to merge 2 commits intomainfrom
fix-data-tracks-subscription-unhandledrejection

Conversation

@1egoman
Copy link
Copy Markdown
Contributor

@1egoman 1egoman commented Apr 24, 2026

When track.subscribe({ signal }) is called and the signal is aborted, IncomingDataTrackManager.openSubscriptionStream rejects two things with the same DataTrackSubscribeError:

  1. The ReadableStream (catchable via try/catch)
  2. An internal sfuSubscriptionComplete promise, used primarily in the tests, but also used during the brief window before the sfu subscription is established to communicate errors back to the user.

Because RemoteDataTrack.subscribe() returns only the stream and discards the promise, no handler was ever attached to the sfuSubscriptionComplete promise, which meant that any rejections become unhandledRejections.

This pull request works around this by adding a no-op .catch(() => {}) to this promise to silence any errors.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 24, 2026

🦋 Changeset detected

Latest commit: d9e9c4a

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 24, 2026

size-limit report 📦

Path Size
dist/livekit-client.esm.mjs 96.87 KB (-0.02% 🔽)
dist/livekit-client.umd.js 105.79 KB (+0.06% 🔺)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants