Skip to content

TrackID is undefined during auto publishing of microphone track (audio={true}) in LiveKitRoom (React Native SDK) #257

@ayush10000

Description

@ayush10000

I’m encountering an issue in the React Native SDK (@livekit/react-native) where auto-publishing of the microphone track sometimes results in a missing track ID. When using the LiveKitRoom component with audio set to true, the SDK automatically handles microphone publishing. However, during this process, the published track sometimes shows trackID as undefined, leading to a runtime error:
“TypeError: Cannot read property 'toLowerCase' of undefined”
Which seems to come from internal SDK code, where toLowerCase() is called on trackID, assuming it is a string. My setup involves the @livekit/react-native SDK (latest version) running on both Android and iOS platforms. I’m using the LiveKitRoom component in this way:
TSX

<LiveKitRoom
  serverUrl="wss://your-livekit-server-url.livekit.cloud"
  token={token}
  connect={true}
  audio={true}
  video={false}
/>

I’m not manually creating or publishing any tracks—the SDK is responsible for auto-publishing the microphone track. However, the SDK sometimes publishes a track object like this:

json
{
  "enabled": true,
  "kind": "audio",
  "muted": false,
  "pID": "PA_dVTQPxudDipR",
  "participant": "qOFJJ4pRNCMHEox2MrN7Gc5PlMO2",
  "room": "room_qOFJJ4pRNCMHEox2MrN7Gc5PlMO2",
  "source": "microphone",
  "streamID": "8297a9c7-3d83-4d40-8301-baa46c419a45",
  "streamTrackID": "8297a9c7-3d83-4d40-8301-baa46c419a45",
  "trackID": undefined
}

Shortly after, I received this error in the logs:

javascript
**TypeError: Cannot read property 'toLowerCase' of undefined**

I expect the SDK to assign a valid string trackID to any auto-published microphone track and to handle cases where trackID might be missing before calling any string methods on it. Since track control is fully managed inside the SDK and not exposed in the React Native version, I believe this is an internal SDK bug. Please let me know if this is a known issue, whether there’s a temporary workaround, or if sharing a minimal reproduction repo would help in diagnosing the problem. Thank you for your work on LiveKit—I look forward to your guidance.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions