producer is not found

Producer 7d9f3eed-8158-4395-b398-4c6a1b82521c is closed: false
Producer transport a6920ff7-5716-44ea-be4e-b45bfbe25c3f is closed: false
Router 015b9fc0-42b6-4d7e-82b5-d109d0eeff1e is closed: false
2022-11-06T00:22:37.740Z mediasoup:ERROR:Router canConsume() | Producer with id "7d9f3eed-8158-4395-b398-4c6a1b82521c" not found

This error sadly pops up while trying to fire: router.canConsume();
As you can see its not actually closed and exists.

Thanks in advance!

The producer is not found on the router you want to consume. It may be on some other router. Kindly check your logic.

Yes okay, but even when piping it just doesn’t work and is unable to find it, but when I check into the router the producer is indeed there.

After piping the producer id gets changed so you need to refer to new producer id on the new router to which you piped the producer.

Check this topic, same issue:

the thing is, it gives the producer not found error when trying to perform pipetorouter.

That simply means the producer doesn’t exist on the router there is no other way. You need to check the code to see what you are doing wrong. Or may be share some code so that we can see.

but when I log the router where the producer is on, i can literally see it on there…

Correction: producer id remains the same after piping.

            let producer = producers.get(socketid)
            let otherRouter = routers.get(socketid);
            let pipeToRouter = await router.pipeToRouter({producerId:, router: otherRouter})

TypeError: Producer not found is the error

in the otherRouter I am able to see a map with 1 producer, which means that it is indeed there.

Error is that producer doesn’t exist in ‘router’, not ‘otherRouter’. Make sure it does exist on ‘router’.

1 Like

yes the thing is, i want it to exist on router

Isn’t the producer on ‘router’? It should be. Lets clarify, what you want is that you have producer on ‘router’ and you want to pipe it to ‘otherRouter’ so that it also become available on ‘otherRouter’ right?

producer is on otherRouter, I now see my mistake and changed them up but now it created even more chaos Error: Channel request handler with ID 009a526e-d946-4a05-a095-f5364add9557 already exists [method:transport.produce]

In that case you should be doing this:
otherRouter.pipeToRouter({ producerId: ‘some id’, router: router });

At which step you are getting this error?

well, pretty sure its at pipetorouter

You cannot call router1.pipeToRouter(router2) if both router1 and router2 are in the same mediasoup Worker.

1 Like

Ahh okay, so what would be the reasonable thing to do instead? As I am creating 1 router per user connected.

This is not the right way to create router. You should create router based upon the room. There can be multiple routers in one room. Don’t create them per user. Create them per call or room, one call can span over multiple routers, workers.

the thing is, there are not really rooms

really simply put its: user1 can hear user2, user2 can hear user3 but user1 may not. as i am creating a game with voicechat

Then create rooms. You can say one room is for one game. Whenever there is a game create room on server then do all the stuff in there. Or simply just create router based upon the voicechat you have if you don’t want to call it room.