node-sonos-http-api: TypeError: Cannot read property 'coordinator' of null

Really weird - this script was working last week - then over the weekend it died… When I restart it I get:

sonos-http-api@0.16.0 start /Users/sonos/Documents/node_modules/node-sonos-http-api-master node server.js

no settings file found, will only use default settings http server listening on port 5005 no preset file, ignoring…

Then when I hit port 500f with next, it doesn’t work and I get this error:

/Users/sonos/Documents/node_modules/node-sonos-http-api-master/lib/actions/nextprevious.js:2 player.coordinator.nextTrack(); ^

TypeError: Cannot read property ‘coordinator’ of null at Object.next (/Users/sonos/Documents/node_modules/node-sonos-http-api-master/lib/actions/nextprevious.js:2:9) at handleAction (/Users/sonos/Documents/node_modules/node-sonos-http-api-master/lib/sonos-http-api.js:65:28) at HttpAPI.requestHandler (/Users/sonos/Documents/node_modules/node-sonos-http-api-master/lib/sonos-http-api.js:47:5) at /Users/sonos/Documents/node_modules/node-sonos-http-api-master/server.js:51:13 at Server.finish (/Users/sonos/Documents/node_modules/node-sonos-http-api-master/node_modules/node-static/lib/node-static.js:111:13) at finish (/Users/sonos/Documents/node_modules/node-sonos-http-api-master/node_modules/node-static/lib/node-static.js:170:14) at /Users/sonos/Documents/node_modules/node-sonos-http-api-master/node_modules/node-static/lib/node-static.js:144:17 at FSReqWrap.oncomplete (fs.js:82:15)

npm ERR! Darwin 14.5.0 npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “start” npm ERR! node v4.2.1 npm ERR! npm v2.14.7 npm ERR! code ELIFECYCLE npm ERR! sonos-http-api@0.16.0 start: node server.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the sonos-http-api@0.16.0 start script ‘node server.js’. npm ERR! This is most likely a problem with the sonos-http-api package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node server.js npm ERR! You can get their info via: npm ERR! npm owner ls sonos-http-api npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /Users/sonos/Documents/node_modules/node-sonos-http-api-master/npm-debug.log

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 1
  • Comments: 42 (14 by maintainers)

Most upvoted comments

On CentOS 7, this error was caused by the firewall. Running these commands fixed my issue.

$ sudo firewall-cmd --zone=public --permanent --add-port=5005/tcp
$ sudo firewall-cmd --zone=public --permanent --add-port=3500/tcp
$ sudo firewall-cmd --zone=public --permanent --add-port=1905/udp
$ sudo firewall-cmd --reload

Not sure for whom this will be useful. I was struggling with Issue 77 on a Windows 10 PC. I had allowed firewall traffic, but only to my private network. In my upgrade to Windows 10, it must have made my networks public. This firewall conflict caused the server to not find Sonos players. I went through the steps to make my network “discoverable” which makes it private; now the server is functional. Excited to have this working!

Applying the firewall configuration by @mrdvt92 on my Debian system fixed the issue for me 👍

One solution I found when running this on my Pi is to just sudo reboot the Pi and that seems to force this to rediscover the Sonos network.

I’ve hit this error when I reboot my routers, and rebooting my Pi has been the easiest solution. I’m sure you could stop and restart this Node.JS service instead if you didn’t want to do a full reboot. For me logging into hombridge and doing a sudo reboot is my fastest path to getting up and running.

@throweggs port-forwarding won’t be enough, and if you use NAT, it won’t work because the discovery protocol relies on the source IP to know where to connect back to.

Sonos (or rather, UPnP) uses bi-directional sockets, which means they need to be addressable and connectable both ways. It also requires either broadcast or multicast traffic to be forwarded, which is rarely the case.

But I would be surprised if Hyper-V doesn’t support a bridge network, where the virtual interface will get an IP from your local DHCP like it’s own dedicated machine? See this article (first section, regarding standard bridged networking) https://smudj.wordpress.com/2015/05/14/windows-10-hyper-v-setting-up-networking-shared-and-bridged-options/

Please open up a new issue or enter the chat as well, because posting comments here notifies anyone subscribing to this topic which is a bit annoying for them 😃

Using the latest version of node-sonos-http-api, recently it cannot find my sonos. Perhaps a recent sonos update? I wondered if anyone else is having a similar issue? I"ve restarted all sonoses, wireless router, server, but still no good. Haven’t changed anything else recently that I can think of.

Factory reset sonos and re-setup. No help.

@hernandito You ca not run this with docker without using bridge networking (thus, no NAT port binding allowed, --net=host). It requires multicast traffic as well as inbound and outbound connections, which makes it super hard to get going between different subnets.

See https://github.com/chrisns/docker-node-sonos-http-api

I too get the error: No system has yet been discovered. Please see #77 if it doesn’t resolve itself in a few seconds.

I’m running the docker image on a Synology NAS. Synology has the option of using a Gui/Wizard to launch the images/create the containers, or to specify the Docker Run parameters. Unfortunately, the --net --restart options do not seem available (according to the IMAGE section here --net=host --restart ). However, I also tried to start the Docker from SSH using the docker run --net=host --restart=always -d <your container/image name> command and I didn’t see a different behavior.

Running the current code (from git) on my Windows laptop, I am able to control my Sonos (although there are issues with TTS).

When I open a terminal on my Docker image (using Synology’s Docker platform) and try something like curl http://localhost:5005/zones I get the same error described in the previous comment: “No system has yet been discovered. Please see #77 if it doesn’t resolve itself in a few seconds.”

This is my first experience with Docker, so my learning curve it steep, but if I can share logs or anything here, I’ll be happy to do it.

How can I debug this further? Is there a way to confirm is it is a problem of multicast packets not reaching my docker?

Thanks.

I tried to