Cannot read property 'sdp' of undefined in Brave
This appears to be related to Brave blocking browser fingerprinting, but the promise returned from RTCPeerConnection.createOffer can resolve to undefined (and not throw) resulting in the following error:
AggregateError: Failed to connect to peer:
TypeError: connection error 127.0.0.1:13579: Cannot read property 'sdp' of undefined
If you disable Shields in Brave it works as expected.
I'm not sure what simple-peer can do about that, other than guard on offer being undefined, treat it as a failure case and throw an appropriate error.
Similar issue: https://github.com/webrtcHacks/adapter/issues/1028
Well, if browser breaks standard APIs, I don't think library should do anything about it. Check what it breaks and make detection outside of simple-peer in your app. You'll want to show a nice message to the user anyway instead of breaking app in unexpected way.
Well, if browser breaks standard APIs, I don't think library should do anything about it
You're correct that it's weird and nonstandard, and perhaps they shouldn't be doing it but part of the reason you use a library is to paper over the cracks in differences between implementations. I note there are already workarounds for other bad browser behaviour.
Check what it breaks and make detection outside of simple-peer in your app
The error occurs during the process of negotiating a connection. In order to make that detection you'd have to start negotiating a connection outside of simple-peer which means you're deep in WebRTC plumbing which sort of negates the point of using simple-peer in the first place.
Has anyone filed an issue with brave? I understand the intention to limit the ip gathering but this solution is quite... harmful
It seems to only happen when on an IP domain (e.g. 127.0.0.1). I've opened an issue with Brave.