Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidStateError: Failed to execute 'setRemoteDescription' on 'RTCPeerConnection': The RTCPeerConnection's signalingState is 'closed' #426

Closed
kevzettler opened this issue Jan 31, 2019 · 8 comments

Comments

@kevzettler
Copy link
Contributor

kevzettler commented Jan 31, 2019

This throws when trying to execute:

      import wrtc from 'wrtc';

      const peer = new SimplePeer({
        wrtc,
        initiator:false,
        trickle:true,
        channelConfig:{
          ordered:false,
          maxRetransmits:0
        },
        config:{
          "iceServers":[{"url":"stun:0.0.0.0:3478"},{"url":"turn:0.0.0.0:3478"}]}
      });
      peer.signal(signalPayload);

Where signalPayload is

   { type: 'offer',
     sdp: 'v=0\r\no=- 4801352722661527119 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE data\r\na=msid-semantic: WMS\r\nm=application 9 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:u6RV\r\na=ice-pwd:KW0TbJYgnCbEx7W8NETh0DKG\r\na=ice-options:trickle\r\na=fingerprint:sha-256 5C:DB:0B:72:03:09:03:6F:EF:17:4C:25:A5:96:9E:0E:91:85:BB:43:80:A6:12:1C:F5:52:95:ED:7F:4E:15:82\r\na=setup:actpass\r\na=mid:data\r\na=sctpmap:5000 webrtc-datachannel 1024\r\n' } }
{ Error: Error: InvalidStateError: Failed to execute 'setRemoteDescription' on 'RTCPeerConnection': The RTCPeerConnection's signalingState is 'closed'.
    at makeError (/Users/kev/code/crashgiants/node_modules/simple-peer/index.js:1037:13)
    at /Users/kev/code/crashgiants/node_modules/simple-peer/index.js:217:44
    at <anonymous>
    at runMicrotasksCallback (internal/process/next_tick.js:121:5)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9) code: 'ERR_SET_REMOTE_DESCRIPTION' }

Not sure if this is a simple-peer config issue or if this is an issue int he Node.js wrtc module.

@t-mullen
Copy link
Collaborator

t-mullen commented Jan 31, 2019

Looks like the peer has been destroyed before you call signal(). Any other errors emitted by the 'error' event?

      import wrtc from 'wrtc';

      const peer = new SimplePeer({
        wrtc,
        initiator:false,
        trickle:true,
        channelConfig:{
          ordered:false,
          maxRetransmits:0
        },
        config:{
          "iceServers":[{"url":"stun:0.0.0.0:3478"},{"url":"turn:0.0.0.0:3478"}]}
      });
      peer.on('error', err => console.error(err)) // <--- 
      peer.signal(signalPayload);

@kevzettler
Copy link
Contributor Author

peer.on('error', err => console.error(err)) // <---

Only gets called with the aforementioned

Error: Error: InvalidStateError: Failed to execute 'setRemoteDescription' on 'RTCPeerConnection': The RTCPeerConnection's signalingState is...

@kevzettler
Copy link
Contributor Author

$ yarn list simple-peer wrtc
yarn list v1.4.0
warning Filtering by arguments is deprecated. Please use the pattern option instead.
├─ simple-peer@9.2.1
└─ wrtc@0.3.5
✨  Done in 1.26s.
$ node -v; npm -v
v8.4.0
6.4.1

@markandrus
Copy link
Contributor

Looks like you are passing the old, nonstandard url property instead of urls. Support for url was removed in wrtc@0.1.0. Perhaps this is the reason: the RTCPeerConnection constructor throws and simple-peer closes.

@kevzettler
Copy link
Contributor Author

@markandrus are you talking about the url in the iceServers array?

"iceServers":[{"url":"stun:0.0.0.0:3478"},{"url":"turn:0.0.0.0:3478"}]}

I don't see any other url reference here?

@nazar-pc
Copy link
Collaborator

nazar-pc commented Feb 1, 2019

@kevzettler
Copy link
Contributor Author

@nazar-pc @markandrus Thank you! That was the issue. Was using url because this is an old project I'm now upgrading dependencies on.

Closing issue. Not sure if there is any action item from simple peer but maybe feel free to add a guard, it would have helped me.

@AkashAsthana
Copy link

Looks like you are passing the old, nonstandard url property instead of urls. Support for url was removed in wrtc@0.1.0. Perhaps this is the reason: the RTCPeerConnection constructor throws and simple-peer closes.

Thanks for that. I was figuring out the error for so long!!! What a relief.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants