We have been using Mediasoup for nearly 3+ years, recently we upgraded our servers, and its been working fine for the last 6 Months, but today, we got an error, it seems to be some issue while creating a transport. Please refer to this image
Please help with creating transport, nothing has been changed in terms of code, we tried to restart the server and deployment on a different machine altogether, but nothing seems to work.
Probably the Router on which you are creating the WebRtcTransport is already closed. Nothing relevant has changed in this regards in last months/years so the fact that you are experimenting this error once in 6 months doesn’t mean there is a bug in mediasoup. Best thing you can do is check your logic.
We have been using the platform on daily basis and we have configured the a version of mediasoup for the deployment, same error with that is coming but it’s working fine on local
case "createWebRtcTransport": {
// NOTE: Don't require that the Peer is joined here, so the client can
// initiate mediasoup Transports and be ready when he later joins.
const { forceTcp, producing, consuming, sctpCapabilities } =
request.data;
const webRtcTransportOptions = {
...config.mediasoup.webRtcTransportOptions,
enableSctp: Boolean(sctpCapabilities),
numSctpStreams: (sctpCapabilities || {}).numStreams,
appData: { producing, consuming },
};
if (forceTcp) {
webRtcTransportOptions.enableUdp = false;
webRtcTransportOptions.enableTcp = true;
}
console.log("CREATEING WEB RTC TRANSPORT");
try{
const transport = await this._mediasoupRouter.createWebRtcTransport({
...webRtcTransportOptions,
webRtcServer: this._webRtcServer,
});
console.log("CREATED WEB RTC TRansport")
transport.on("sctpstatechange", (sctpState) => {
logger.debug(
'WebRtcTransport "sctpstatechange" event [sctpState:%s]',
sctpState
);
});
transport.on("dtlsstatechange", (dtlsState) => {
if (dtlsState === "failed" || dtlsState === "closed")
logger.warn(
'WebRtcTransport "dtlsstatechange" event [dtlsState:%s]',
dtlsState
);
});
// NOTE: For testing.
// await transport.enableTraceEvent([ 'probation', 'bwe' ]);
await transport.enableTraceEvent(["bwe"]);
transport.on("trace", (trace) => {
logger.debug(
'transport "trace" event [transportId:%s, trace.type:%s, trace:%o]',
transport.id,
trace.type,
trace
);
if (trace.type === "bwe" && trace.direction === "out") {
peer
.notify("downlinkBwe", {
desiredBitrate: trace.info.desiredBitrate,
effectiveDesiredBitrate: trace.info.effectiveDesiredBitrate,
availableBitrate: trace.info.availableBitrate,
})
.catch(() => { });
}
});
// Store the WebRtcTransport into the protoo Peer data Object.
peer.data.transports.set(transport.id, transport);
accept({
id: transport.id,
iceParameters: transport.iceParameters,
iceCandidates: transport.iceCandidates,
dtlsParameters: transport.dtlsParameters,
sctpParameters: transport.sctpParameters,
});
}catch(e){
console.log("ERROR while create TRANSPORT");
console.log('----------')
console.log(e);
console.log('----------')
}
const { maxIncomingBitrate } = config.mediasoup.webRtcTransportOptions;
// If set, apply max incoming bitrate limit.
if (maxIncomingBitrate) {
try {
await transport.setMaxIncomingBitrate(maxIncomingBitrate);
} catch (error) { }
}
break;
}
After this CREATED WEB RTC TRansport, catch block is console gets printed