Cannot destructure property 'id' of '(intermediate value)' as it is undefined.

Hello I’m trying to create a video conferencing application based on Mediasoup but I get this error when I do a “transport.produce()” client-side.

Cannot destructure property 'id' of '(intermediate value)' as it is undefined.

I have no idea what it is due to, even after doing a lot of research, so I would like to know if you have a solution.


socket.once('transport.config', (data) => {
    if (!device) return;

        routerRtpCapabilities: { codecs: rtp.mediaCodecs, headerExtensions: rtp.headerExtensions }
    }).then(async () => {
        if (device.canProduce('video')) {
            const videoStream = await navigator.mediaDevices.getUserMedia({ video: true }).catch(console.error),
                videoTrack = videoStream.getVideoTracks()[0];

            const { sendTransport, rcvTransport } = data;
            const transportSend = device.createSendTransport({ ...rcvTransport });
            transportSend.on('connect', async ({ dtlsParameters }, callback, errback) => {
                socket.emit('transport-connect', { dtlsParameters, transportId: });
                socket.once('transport-connect-response', callback);
            transportSend.on('produce', async ({ kind, rtpParameters, appData }, callback, errback) => {
                socket.emit('transport-produce', {
                socket.once('transport-produce-response', callback);
            transportSend.on('connectionstatechange', (connectionState) => console.log('TransportSend ConnectionState:', connectionState));
            transportSend.produce({ track: videoTrack }).then((producer) => {
                console.log('produced', producer);
        } else {
            console.log('cant do video');


const sendTransport = await router.createWebRtcTransport({
    listenIps: [
        { ip: '', announcedIp: null },
        { ip: '', announcedIp: null },
    enableUdp: true,
    enableTcp: true,
    preferUdp: true
sendTransport.on('icestatechange', (icestate) => console.log('IceState =>', icestate));
socket.once('transport-connect', ({ transportId, dtlsParameters }) => {
    sendTransport.connect({ dtlsParameters });
socket.once('transport-produce', ({ transportId, kind, rtpParameters, appData }) => {
    console.log('producing', kind, rtpParameters);
    const produced = sendTransport.produce({ kind, rtpParameters, appData });
socket.emit('transport.config', {
    rcvTransport: {
        iceParameters: sendTransport.iceParameters,
        iceCandidates: sendTransport.iceCandidates,
        dtlsParameters: sendTransport.dtlsParameters,
        sctpParameters: sendTransport.sctpParameters

Thank you in advance for your help.

First you cannot use for request/response by using just events. Learn about using request/response in first (topic not covered by this forum).

Second, check again the transport “produce” event documentation. You must invoke the given “callback” with an Object with the “id” of the server-side created Producer as argument.

Hello, thanks you for helping me.

I have no problem with, but i solved my problem by passing to the producer client-side callback, the producer id created server-side.

Thanks again :wink:

No, but you will have as far as you try to create two producers at the same time.

your work is as good as you are a toxic person.

Euh wtf ?

his tone is very condescending in most of the posts.

Hi, @nadirabbas. You are banned from this forum and our GitHub repositories. Fuck you.

yes, ban the person who tells you your reality, you moron.

Don’t worry, bunch of crap. Banned again.