node-sonos-discovery icon indicating copy to clipboard operation
node-sonos-discovery copied to clipboard

Uncaught (in promise) TypeError: Cannot read property 'baseUrl' of undefined

Open tiptronic opened this issue 5 years ago • 1 comments

I just switched networks and ran this line:

let discovery = new SonosDiscovery(sonosDiscoverySettings);

and getting the error:

Uncaught (in promise) TypeError: Cannot read property 'baseUrl' of undefined
    at NotificationListener.topologyChange (/Users/andy/dev-git/ElectroKC/node_modules/sonos-discovery/lib/SonosSystem.js:109)
    at NotificationListener.emit (events.js:182)
    at parseTopology.then (/Users/andy/dev-git/ElectroKC/node_modules/sonos-discovery/lib/NotificationListener.js:117)
    at process._tickCallback (internal/process/next_tick.js:68)

the error appears here (SonosSystem.js around line 109):

    // Update available services
    const anyPlayer = _this.getAnyPlayer();
    soap.invoke(`${anyPlayer.baseUrl}/MusicServices/Control`, soap.TYPE.ListAvailableServices)

I have a player here, but even if not - it should not throw, or?

Any idea or mechanism to recover from this situation?

tiptronic avatar Apr 18 '19 14:04 tiptronic

Here's a bit more information: I removed one of my SonosOne speakers from a stereo-pair into a new network. What I didn't do was to split the stereo-pair. So Sonos showed me the room, with a question-mark (as one speaker) and the other speaker. This triggered the error. After I split the speaker-pair the problem disappeared... (btw: Sonos own desktop app didn't find the speakers as well - just the iOS.app showed the problem)

tiptronic avatar Apr 18 '19 14:04 tiptronic