Honor options.fetch on /generate-ice-servers request#396
Closed
thanipro wants to merge 2 commits intocloudflare:mainfrom
Closed
Honor options.fetch on /generate-ice-servers request#396thanipro wants to merge 2 commits intocloudflare:mainfrom
thanipro wants to merge 2 commits intocloudflare:mainfrom
Conversation
`makePeerConnectionSessionCombo`'s `iceServers` arm of the forkJoin wasn't passing `fetchImpl: options.fetch`, so even when a consumer configured a custom `fetch` on `PartyTracksConfig` (e.g. to inject an Authorization header), the GET fell back to the global `fetch` with no consumer headers. The matching `sessionId` arm two lines above already passed `fetchImpl: options.fetch`. This brings the iceServers arm in line. No behavior change for consumers without a custom fetch — `fetchImpl` defaults to global fetch via fromFetch.ts:35. Caught when `tranqbay/call` ran with an authenticated `/partytracks/*` proxy: POST /sessions/new succeeded, GET /generate-ice-servers 401'd. Symmetric NAT clients then fell back to STUN-only ICE.
🦋 Changeset detectedLatest commit: c962b1a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tiny one-line fix in
makePeerConnectionSessionCombo. Thesessions/newrequest honorsoptions.fetchviafetchImpl, but the/generate-ice-serversrequest doesn't — they should match.If a consumer wires up a custom
fetchviaPartyTracksConfig.fetch(to inject auth headers, add tracing, retry on transient failures, sign requests, etc.), it currently silently doesn't apply to the iceServers GET. So whatever that fetch was doing — Authorization headers, request signing, anything — gets dropped on that one request.iceServers: options.iceServers ? of(options.iceServers) : fromFetch(`${options.prefix}/generate-ice-servers`, { + fetchImpl: options.fetch, selector: (res) => res .json() .then( (body) => (body as { iceServers: RTCIceServer[] }).iceServers ) })No behavior change for consumers that don't pass a custom fetch —
fetchImpldefaults to the globalfetchinfromFetch.ts:35.Changeset added (patch). Happy to add a unit test if you want one — let me know your preferred shape since the existing tests in
tests/don't currently exercise thefetchImplplumbing.Disclosure: drafted with help from an AI coding assistant (Claude), reviewed and tested locally before opening.