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

TypeError: Cannot read property 'coordinator' of null #77

Closed
Dratsum opened this issue Nov 3, 2015 · 42 comments
Closed

TypeError: Cannot read property 'coordinator' of null #77

Dratsum opened this issue Nov 3, 2015 · 42 comments

Comments

@Dratsum
Copy link

Dratsum commented Nov 3, 2015

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

@jishi
Copy link
Owner

jishi commented Nov 3, 2015

Sounds like it doesn't find your players. Could you please try and specify the following in settings.json (create it if it doesn't exists):

{ disableIpDiscovery: true }

@jishi
Copy link
Owner

jishi commented Nov 22, 2015

Closing until feedback arrives.

@jishi jishi closed this as completed Nov 22, 2015
@pmonday
Copy link

pmonday commented Dec 12, 2015

While I don't see the verbose dump above, when I start with npm start or node server.js (so I can use settings.json) I do receive the error that my system has not yet been discovered. I tried the disableIpDiscovery.

No system has yet been discovered. Please see #77 if it doesn't resolve itself in a few seconds.
No system has yet been discovered. Please see #77 if it doesn't resolve itself in a few seconds.

My Sonos setup is is a cabled Bridge (old school). So the bridge acquired 192.168.1.2, then I have two speakers coming in through wireless: 192.168.1.9 (Master Bedroom) and 192.168.1.12 (TV Room).

My Server is wired-only if that makes any difference, 192.168.1.200.

Does the bridge have to be in discovery mode or anything like that?

@jishi
Copy link
Owner

jishi commented Dec 12, 2015

@pmonday No, there is no special setup required. The bridge in itself would not require an IP anyway, since it forwards traffic transparently. My first check would be if your centos installation comes with any form of default ip-tables rules, or some configuration that blocks multicast traffic.

@dolphinkite
Copy link

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

@jishi
Copy link
Owner

jishi commented Dec 14, 2015

@dolphinkite Since this is related to Docker, could you please file a new issue and reference @riemers in it? I haven't tested the Docker image myself, but he might have some answers.

@eg33
Copy link

eg33 commented Mar 20, 2016

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!

@cvcruz
Copy link

cvcruz commented Jun 19, 2016

@eg33 What are the steps to make network "discoverable"? I'm alson on Win 10PC and seeing this issue. I have added { disableIpDiscovery: true } to settings.json to no avail.

Thanks for your help.

Actually. Got it. Sorry for the trouble!

@jishi
Copy link
Owner

jishi commented Jun 19, 2016

For future reference, please test the beta branch if you have connectivity issues. It has been drastically improved when it comes to discovery.

@aaronmfisherSYP
Copy link

I am actively having this issue with release and beta channel. I do not have the issue on my mac at home though, only my work laptop. I have full admin rights so nothing restricting usage.

@jishi
Copy link
Owner

jishi commented Aug 18, 2016

@aaronmfisherSYP With your work laptop, at home, or at work? Is it intermittent or permanent? Is it Windows or OS X? Are you using some sort of VPN?

@aaronmfisherSYP
Copy link

@jishi work laptop at work, same issue occurs with it at home. No issues on home Mac at home. Permanent error at work on machine, which is running OS X. No VPN usage. Network allows cross IP traffic and nothing on the network is preventing it.

@aaronmfisherSYP
Copy link

Solved.

@jishi
Copy link
Owner

jishi commented Aug 19, 2016

@aaronmfisherSYP Please share the solution if you think it can benefit others, since I refer people to this issue.

@tundal
Copy link

tundal commented Sep 10, 2016

@aaronmfisherSYP Can you share your solution? Having issue with RPI setup. Everything seems to work in my MAC.

@jishi
Copy link
Owner

jishi commented Sep 11, 2016

@tundal How is it connected to your network? What Linux dist are you running?

@tundal
Copy link

tundal commented Sep 14, 2016

@jishi:
Linux Dist (Raspbian): Linux Debian 8.0 4.4.13-v7+ armv7l
Network: RPI is connected to AP (WiFI and LAN both)

My failure did not have exact signature as this issue but looked similar. Solution provided in #39 addressed my issue where node wasn't starting at all for me. @csteenwyk's solution allows node to start. I will look through issues to make sure my comments are correctly added to right issue.

@jishi
Copy link
Owner

jishi commented Sep 14, 2016

@tundal I suggest you file a new issue with the output of your startup.

You can also start it with NODE_LOG_LEVEL=trace node server.js which would show if it is scanning for players or not.

@Dratsum
Copy link
Author

Dratsum commented Sep 14, 2016

So - turns out I don't get this error over ethernet, only wifi.

On Wed, Sep 14, 2016 at 8:55 AM, Jimmy Shimizu notifications@github.com
wrote:

@tundal https://github.com/tundal I suggest you file a new issue with
the output of your startup.

You can also start it with NODE_LOG_LEVEL=trace node server.js which
would show if it is scanning for players or not.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#77 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACXEmBxvkt-1GGgFku3RQA4gn-oRIqZAks5qp-7XgaJpZM4GbFk2
.

@jishi
Copy link
Owner

jishi commented Sep 15, 2016

@Dratsum Then it's probably the driver at fault, unless you have a weird WiFi setup at home. Some routers may block certain traffic between WiFi and wired LAN.

@CrEaK
Copy link

CrEaK commented Sep 15, 2016

I got the same error on my raspberry pi until this morning everything worked fine. I restarted the node-server and after that a http-request just prints this:

> sonos-http-api@1.0.0-beta.23 start /home/pi/sonos-api
> node server.js

http server listening on port 5005
no preset file, ignoring...
No system has yet been discovered. Please see https://github.com/jishi/node-sonos-http-api/issues/77 if it doesn't resolve itself in a few seconds.

I made no changes at all on the raspberry pi. Any idea?

EDIT

Reboot fixed the issue. Sorry! :)

@hernandito
Copy link

hernandito commented Feb 18, 2017

I get the same error when I go to http://192.168.0.201:5151/zones:

{"status":"error","error":"No system has yet been discovered. Please see https://github.com/jishi/node-sonos-http-api/issues/77 if it doesn't resolve itself in a few seconds."}

I am using port 5151 because I am using node.js in a Docker which port 5006 to external ip 5151. I am using the lasted version. I think oprt 5005 is already used in my network. When I go to the url http://192.168.0.201:5151/ I get the Sonos API screen.

I also tried adding this on the settings.json with the same results:

var settings = {
disableIpDiscovery: true,
port: 5005,
securePort: 5006,
cacheDir: path.resolve(__dirname, 'cache'),

Any idea what I could try to make it work? This is what gets displayed when I do npm start:

root@636339137e08:~/node_modules/sonos-http-api#

npm start

sonos-http-api@1.3.0 start /root/node_modules/sonos-http-api
node server.js

2017-02-18T20:30:08.153Z INFO Could not find file /root/node_modules/sonos-http-api/settings.json
2017-02-18T20:30:08.406Z INFO Presets loaded: { presets:
{ players:
[ { roomName: 'Antonio Room', volume: 50 },
{ roomName: 'Staci Office', volume: 50 } ],
playMode: { shuffle: true, repeat: 'all', crossfade: false },
pauseOthers: false,
favorite: 'My example favorite' } }
2017-02-18T20:30:08.567Z INFO http server listening on port 5006
2017-02-18T20:30:20.288Z ERROR No system has yet been discovered. Please see #77 if it doesn't resolve itself in a few seconds.

Many thanks,
H.

ps - Crazy thought. I have the Sonos as devices in my SmartThings hub. Could this be the culprit?

@jishi
Copy link
Owner

jishi commented Feb 18, 2017

@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

@hernandito
Copy link

hernandito commented Feb 18, 2017

Thank you Jishi... I hardly can understand your explanation, but luckily I run unRAID which makes Dockers very easy. I switched from "bridge" mode to "host" mode

image

and I get the following in /zones (copied only a part):

[{"uuid":"RINCON_B8E93791CA9401400","coordinator":{"uuid":"RINCON_B8E93791CA9401400","state":{"currentTrack":{"artist":"","title":"","album":"","albumArtUri":"","duration":0,"uri":"","type":"track","stationName":""},"nextTrack":{"artist":"","title":"","album":"","albumArtUri":"","duration":0,"uri":""},"volume":67,"mute":false,"trackNo":0,"elapsedTime":0,"elapsedTimeFormatted":"00:00:00","playbackState":"STOPPED","playMode":{"repeat":"none","shuffle":false,"crossfade":false}},"roomName":"Living Room","coordinator":"RINCON_B8E93

I assume it is all good now? I am off to try to create an Alexa Skill for this. Thank you very much for your help and for creating this!

H.

@pcgirl
Copy link

pcgirl commented Dec 3, 2017

Thanks, this worked for me also using unraid!

@onoffpt
Copy link

onoffpt commented Feb 18, 2018

Thanks @jishi . If anyone else is trying to run node inside a VM, make sure your network settings are configured as "bridged" instead of the default NAT.
screenshot from 2018-02-18 01-39-55

@ddurham2
Copy link

ddurham2 commented Jun 18, 2018

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.

@throweggs
Copy link

Hi There,
I'm trying to get this up and running on a VM in a hyper-V environment, I think I have a issue with the NAT I've seen others have turned the VMs network mode into bridged and have seen that this works. However, I do no have this luxury I was what ports does your API work with, whether I can do a port forward through the Hyper-V. I've reduced the firewall to off on my VM to see if that would help and it was not.

ERROR:
{"status":"error","error":"No system has yet been discovered. Please see #77 if it doesn't resolve itself in a few seconds."}

cmd:
2018-12-03T16:21:11.356Z ERROR No system has yet been discovered. Please see htt
ps://github.com//issues/77 if it doesn't resolve itself
in a few seconds.

Any pointers will be great, end game is that I might just have to host it on a basic box somewhere on the network.

@jishi
Copy link
Owner

jishi commented Dec 3, 2018

@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 :)

@CaseyRo
Copy link

CaseyRo commented Jul 4, 2019

Having issues as well, then all the sudden it works (seemingly) but after a reboot it doesn't. "M-SEARCH" is being sent, used "disableIpDiscovery: true" and without, both with no changes.

Sonos controller works fine, also assigned sonos fixed IP's to prevent other things. Can I set these in the settings.json in some way?

@Jaclawiciel
Copy link

It happened to me too, running API on Pi. Restart of Pi and Sonos did nothing. Restarting the router (Airport Express) helped.

@jedbro
Copy link

jedbro commented May 1, 2020

I'm hitting this as well.
I'm running Node JS and this addition on a Windows 10 server. Everything works great for a while, and then every day or so it just stops and when I got to the machine I can see in my powershell this error and going to http://192.168.0.17:5005/zones gives me an error.

It's as if something has changed and node-sonos-http-api can't seem to recover.

Doing the CTRL+C and restarting this server solves the issue momentarily.

@mrdvt92
Copy link

mrdvt92 commented Jun 18, 2020

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

@curious-attempt-bunny
Copy link

I'm seeing this issue also. But not all the time. So it's unclear to me what options I have to work-around the problem.

2020-09-29T21:13:50.631Z INFO http server listening on 0.0.0.0 port 5005
2020-09-29T21:13:53.841Z ERROR No system has yet been discovered. Please see https://github.com/jishi/node-sonos-http-api/issues/77 if it doesn't resolve itself in a few seconds.
(node:43539) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
2020-09-29T21:14:10.612Z ERROR No system has yet been discovered. Please see https://github.com/jishi/node-sonos-http-api/issues/77 if it doesn't resolve itself in a few seconds.
2020-09-29T21:14:11.741Z ERROR No system has yet been discovered. Please see https://github.com/jishi/node-sonos-http-api/issues/77 if it doesn't resolve itself in a few seconds.
2020-09-29T21:14:12.331Z ERROR No system has yet been discovered. Please see https://github.com/jishi/node-sonos-http-api/issues/77 if it doesn't resolve itself in a few seconds.
2020-09-29T21:14:12.892Z ERROR No system has yet been discovered. Please see https://github.com/jishi/node-sonos-http-api/issues/77 if it doesn't resolve itself in a few seconds.
2020-09-29T21:14:13.411Z ERROR No system has yet been discovered. Please see https://github.com/jishi/node-sonos-http-api/issues/77 if it doesn't resolve itself in a few seconds.
2020-09-29T21:14:13.916Z ERROR No system has yet been discovered. Please see https://github.com/jishi/node-sonos-http-api/issues/77 if it doesn't resolve itself in a few seconds.
2020-09-29T21:14:14.467Z ERROR No system has yet been discovered. Please see https://github.com/jishi/node-sonos-http-api/issues/77 if it doesn't resolve itself in a few seconds.
2020-09-29T21:14:14.974Z ERROR No system has yet been discovered. Please see https://github.com/jishi/node-sonos-http-api/issues/77 if it doesn't resolve itself in a few seconds.
2020-09-29T21:14:15.510Z ERROR No system has yet been discovered. Please see https://github.com/jishi/node-sonos-http-api/issues/77 if it doesn't resolve itself in a few seconds.
2020-09-29T21:14:16.013Z ERROR No system has yet been discovered. Please see https://github.com/jishi/node-sonos-http-api/issues/77 if it doesn't resolve itself in a few seconds.
2020-09-29T21:14:16.551Z ERROR No system has yet been discovered. Please see https://github.com/jishi/node-sonos-http-api/issues/77 if it doesn't resolve itself in a few seconds.
2020-09-29T21:14:18.302Z ERROR No system has yet been discovered. Please see https://github.com/jishi/node-sonos-http-api/issues/77 if it doesn't resolve itself in a few seconds.
$ git log -1
commit 7b5d5e45863a4ea88a34aab3e554e282ab93b945 (HEAD -> master, origin/master, origin/HEAD)
Author: Jimmy Shimizu <jimmy@shimizu.se>
Date:   Mon Jun 22 10:40:18 2020 +0200

    Update README.md
$ node --version
v14.8.0

What are folks doing for this to get this to work reliably?

@curious-attempt-bunny
Copy link

I know how to recreate the problem. It's when I join my work's VPN:

$ sudo ifconfig > ifconfig.novpn.txt
  # I connect to the VPN, and then:
$ sudo ifconfig > ifconfig.vpn.txt  
$ diff ifconfig.novpn.txt ifconfig.vpn.txt 
93a94,98
> utun2: flags=80d1<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1390
> 	inet REDACTED --> REDACTED netmask 0xffffff00 
> 	inet6 REDACTED%utun2 prefixlen 64 scopeid 0x11 
> 	inet6 fREDACTED%utun2 prefixlen 128 scopeid 0x11 
> 	nd6 options=201<PERFORMNUD,DAD>

@jishi
Copy link
Owner

jishi commented Sep 29, 2020 via email

@jedbro
Copy link

jedbro commented Oct 24, 2020

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.

@bobvandevijver
Copy link

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

@dfoxg
Copy link

dfoxg commented Dec 1, 2020

My problem was that the Windows Firewall setting was set to Public, not Private. After I changed the setting to Private, the detection worked.

@DJT1423
Copy link

DJT1423 commented Sep 13, 2021

Above, you instruct:
"Sounds like it doesn't find your players. Could you please try and specify the following in settings.json (create it if it doesn't exists):
{ disableIpDiscovery: true }

Could you detail how to create settings.json?
Thanks

@jishi
Copy link
Owner

jishi commented Sep 13, 2021 via email

@DJT1423
Copy link

DJT1423 commented Sep 13, 2021

Perfect, thx. That did the trick

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