mediasoup:ERROR:Consumer after little bit of time using mediasoup demo

Hi, im running one “modified” instance of mediasoup-demo in AWS, and i get this error after a peer is connected a few minutes:

safeEmit() | event listener threw an error [event:layerschange]:TypeError: Cannot destructure property spatialLayer of ‘undefined’ or ‘null’. at Consumer.consumer.on (/home/ubuntu/mediasup/server/lib/Room.js:1196:31) at emitOne (events.js:116:13) at Consumer.emit (events.js:211:7) at Consumer.safeEmit (/home/ubuntu/mediasup/server/node_modules/mediasoup/lib/EnhancedEventEmitter.js:18:9) at Channel._channel.on (/home/ubuntu/mediasup/server/node_modules/mediasoup/lib/Consumer.js:431:11) at emitTwo (events.js:126:13) at Channel.emit (events.js:214:7) at Channel._processMessage (/home/ubuntu/mediasup/server/node_modules/mediasoup/lib/Channel.js:304:9) at Socket.Channel._socket.on (/home/ubuntu/mediasup/server/node_modules/mediasoup/lib/Channel.js:101:13) at emitOne (events.js:116:13) +3s

Can you help me? im a little bit confused
PD: Te sigo en Twitter Iñaki, felicitaciones por el excelente y prolijo trabajo que hacen con mediasoup y JsSip, un abrazo, soy @mytwocentsgames

Hi, as the documentation says, the Consumer’s “layerschange” event can be emitted with layers = null in certain cases:

Thank you very much for the quick answer. Okay, but when that error starts, video quality is greatly reduced, is that normal?. When you refresh the browser, it is solved momentarily

That’s too generic question, sorry. Yes, bandwidth estimation is reduced when there is network problems or lot of packet lost, etc. Initially it’s not.

Okey, thank you Iñaki! hugs!