fix: support multiple payload-types #182
Open
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.
I was getting this error when trying to join an intercom channel:
Exception thrown when trying to create endpoint: TypeError: Cannot read properties of undefined (reading 'id')
Manager listening on http://127.0.0.1:8000
Media Bridge at http://host.docker.internal:8081 (60s idle timeout)
Created user session: "Meh": 5b5f9cb7-400a-4c75-a42e-1220251ea805
[connection b5ca8365-cb0f-4678-8575-077ceb054b8f] Create, sfuResourceId Meh
TypeError: Cannot read properties of undefined (reading 'id')
at Connection.addIngestMids (/app/src/connection.ts:183:52)
at Connection.createOffer (/app/src/connection.ts:70:10)
at CoreFunctions.createConnection (/app/src/api_productions_core_functions.ts:69:50)
at Object. (/app/src/api_productions.ts:706:46)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
The problem was that payload-type is no longer a single entry, but there's now a payload-types array. To fix this, if we don't find payload-type, use the "opus" entry from payload-types if present, otherwise the first entry in payload-types, then proceed as before.