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

Cannot read property ‘fd’ of null #16

Open
honcheng opened this issue Aug 23, 2017 · 3 comments
Open

Cannot read property ‘fd’ of null #16

honcheng opened this issue Aug 23, 2017 · 3 comments

Comments

@honcheng
Copy link

honcheng commented Aug 23, 2017

I’m not able to run the example.js.
When I made the first request, it prints out this without any notifications in Google Home.

{ text: 'Hello Google Home' }
Device "Google-Home-3e482a7482fb715cf1cc578a08278d10" at 192.168.1.88:8009

Then, subsequent requests will get this error. I made sure I have the latest version of nodejs.

{ text: 'Hello Google Home' }
TypeError: Cannot read property 'fd' of null
at Browser.start (/home/pi/google-home-notifier/node_modules/mdns/lib/mdns_service.js:32:35)
at Object.notify (/home/pi/google-home-notifier/google-home-notifier.js:23:13)
at /home/pi/google-home-notifier/example.js:20:16
at Layer.handle [as handle_request] (/home/pi/google-home-notifier/node_modules/express/lib/router/layer.js:95:5)
at next (/home/pi/google-home-notifier/node_modules/express/lib/router/route.js:137:13)
at /home/pi/google-home-notifier/node_modules/body-parser/lib/read.js:130:5
at invokeCallback (/home/pi/google-home-notifier/node_modules/raw-body/index.js:262:16)
at done (/home/pi/google-home-notifier/node_modules/raw-body/index.js:251:7)
at IncomingMessage.onEnd (/home/pi/google-home-notifier/node_modules/raw-body/index.js:307:7)
at emitNone (events.js:105:13)

@honcheng
Copy link
Author

Problem goes away when reverting back to this commit ae2b118

@tinoue
Copy link

tinoue commented Jun 20, 2018

The error occurs when google-home-notifier can't find Google Home by mDNS.
In my case my wifi access point disables all multicast transmission.

@kazhik
Copy link

kazhik commented Sep 2, 2018

If service.name('Google-Home-***') doesn't contain device(Google Home), browser is stopped.
Next call of browser.start() will throw TypeError: Cannot read property 'fd' of null.

  if (!deviceAddress){
     browser.start();
     browser.on('serviceUp', function(service) {
      console.log('Device "%s" at %s:%d', service.name, service.addresses[0], service.port);
      if (service.name.includes(device.replace(' ', '-'))){
        deviceAddress = service.addresses[0];
        getSpeechUrl(message, deviceAddress, function(res) {
          callback(res);
        });
      }
      browser.stop();

Fix: kazhik@34e9f53

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

3 participants