Raspberry PI mdns getaddrinfo 3008 error - node.js

I've this sample Node.js script:
var mdns = require('mdns');
var browser = mdns.createBrowser(mdns.tcp('http'));
browser.on('error', function (error) {
console.log("error");
console.log(error);
});
browser.on('serviceUp', function (service) {
console.log("serviceUp");
console.log(service);
});
browser.start();
On my Mac it's working fine, and two services is found. If I run the exact same script on my Raspberry PI 2 running Raspbean (connected to the same network), I get this output:
pi#raspberrypi ~ $ node mdns.js
*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node>
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister>
error
{ [Error: getaddrinfo -3008] code: -3008, errno: -3008, syscall: 'getaddrinfo' }
error
{ [Error: getaddrinfo -3008] code: -3008, errno: -3008, syscall: 'getaddrinfo' }
A issue on the mdns GitHub, states that it's fair to ignore the warnings.
But what about the two errors? Is that some kind of configuration issue on my Raspberry PI?

It's a bad practice to modify node modules code locally.
You should better do the following when you create a mdns Browser:
var sequence = [
mdns.rst.DNSServiceResolve(),
'DNSServiceGetAddrInfo' in mdns.dns_sd ? mdns.rst.DNSServiceGetAddrInfo() : mdns.rst.getaddrinfo({families:[4]}),
mdns.rst.makeAddressesUnique()
];
var browser = mdns.createBrowser(mdns.tcp('http'), {resolverSequence: sequence});
Like said in this comment: https://github.com/agnat/node_mdns/issues/130#issuecomment-120731155
Thus, it will avoid bugs and allow everybody working on the project to get the same version and don't have to modify locally mdns code.

A solution was found on this GitHub issue:
https://github.com/agnat/node_mdns/issues/130
Modify Browser.defaultResolverSequence inside lib/browser.js in mdns.
Browser.defaultResolverSequence = [
rst.DNSServiceResolve(), 'DNSServiceGetAddrInfo' in dns_sd ? rst.DNSServiceGetAddrInfo() : rst.getaddrinfo({families:[4]})
, rst.makeAddressesUnique()
];

Related

Hexo init fail on windows 10

When I try to run hexo init in Git Bash in Windows10, it fail and show following :
INFO Cloning hexo-starter https://github.com/hexojs/hexo-starter.git
fatal: unable to access 'https://github.com/hexojs/hexo-starter.git/': Failed to connect to localhost port 1080: Connection refused
WARN git clone failed. Copying data instead
FATAL {
err: [Error: ENOENT: no such file or directory, scandir 'C:\Users\Administrator\AppData\Roaming\npm\node_modules\hexo-cli\assets'] {
errno: -4058,
code: 'ENOENT',
syscall: 'scandir',
path: 'C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\hexo-cli\\assets'
}
} Something's wrong. Maybe you can find the solution here: %s http://hexo.io/docs/troubleshooting.html
How does it happen and how do we solve it?
I had the issue too. Tried again after a few minutes it worked. It due to bad access to github.com from China.
Try to run the same command from powershell non admin. If it does not work, try npx hexo init

Getting ENOTSUP error on nodejs 0.12.6 app running in Azure Websites

I recently upgraded by version of nodejs on my windows azure web application from 0.12.0 to 0.12.6. Since then, whenever I relaunch my app on visual studio online editor, the console reports a significant errors like these ones:
glob error { [Error: ENOTSUP, scandir 'D:\home\site\wwwroot\views\partials\recommendationModal.handlebars']
errno: -4049,
code: 'ENOTSUP',
path: 'D:\\home\\site\\wwwroot\\views\\partials\\recommendationModal.handlebars' }
glob error { [Error: ENOTSUP, scandir 'D:\home\site\wwwroot\views\partials\register.handlebars']
errno: -4049,
code: 'ENOTSUP',
path: 'D:\\home\\site\\wwwroot\\views\\partials\\register.handlebars' }
glob error { [Error: ENOTSUP, scandir 'D:\home\site\wwwroot\views\partials\search.handlebars']
errno: -4049,
code: 'ENOTSUP',
path: 'D:\\home\\site\\wwwroot\\views\\partials\\search.handlebars' }
glob error { [Error: ENOTSUP, scandir 'D:\home\site\wwwroot\views\partials\spinningWheel.handlebars']
errno: -4049,
code: 'ENOTSUP',
path: 'D:\\home\\site\\wwwroot\\views\\partials\\spinningWheel.handlebars' }
glob error { [Error: ENOTSUP, scandir 'D:\home\site\wwwroot\views\partials\stylesFilterButtons.handlebars']
errno: -4049,
code: 'ENOTSUP',
path: 'D:\\home\\site\\wwwroot\\views\\partials\\stylesFilterButtons.handlebars' }
All of the files in the error descriptions are handlebars partials.
I run the same app on my local development environment (linux with nodejs 0.12.6) and these errors never show up.
At first glance, it looks like there is something broken on azure websites when running your app on 0.12.6, but I'd like to post this situation here in SO to see if other people have faced the same issue and how they managed to resolve it.
This very much looks like this bug. Sounds like you may have glob 5.0.13 or earlier installed. Try 5.0.14 and it will hopefully solve your problem.
Just had the same issue with Azure. Mine happened to be glob as one comment stated.
express-handlebars has fixed this issue if you update to 3.0.0

Unknown error while running node_mdns on node.js on raspberry pi

I've been trying to create a node.js application with express that does some ZeroConf discovery on the network and runs on a Raspberry Pi. While the app is working fine on my development machine, I get an error when running it on a Raspberry Pi.
The raspberry pi is running node 0.10.5, and node_mdns as the package to do the zeroconf discovery. Al required libraries that are mentioned on the node_mdns install page are installed and up to date.
The app launches correctly, but when a device is discovered I get the following error.
{ [Error: dns service error: unknown] errorCode: -65537 }
events.js:72
throw er; // Unhandled 'error' event
^
Error: dns service error: unknown
at MDNSService.on_resolver_done (/home/pi/projects/test/node_modules/mdns/lib/resolver_sequence_tasks.js:19:30)
at SocketWatcher.MDNSService.self.watcher.callback (/home/pi/projects/test/node_modules/mdns/lib/mdns_service.js:17:38)
It doens't seem to be a network issue, because it only happens on the raspberry pi, not on other devices in the network.
If anybody has had the same problem and managed to fix it, it would be greatly appreciated.
Update: This issue is now fixed, https://github.com/agnat/node_mdns/issues/70.
I'm also getting an error with Node.js, ZeroConf and the Pi. Again, it also works on my development machine, but not on the Pi. Which sort of rules out a network or code problems on my end of things,
node_modules/mdns/lib/advertisement.js:56
dns_sd.DNSServiceRegister(self.serviceRef, flags, ifaceIdx, name,
^
Error: dns service error: unknown
at new Advertisement (node_modules/mdns/lib/advertisement.js:56:10)
at Object.create [as createAdvertisement] (node_modules/mdns/lib/advertisement.js:64:10)
at /home/pi/steward/steward/core/server.js:105:10
at Server.onListen (node_modules/portfinder/lib/portfinder.js:48:5)
at Server.g (events.js:175:14)
at Server.EventEmitter.emit (events.js:92:17)
at net.js:1035:10
at process._tickCallback (node.js:415:13)
Suggestions welcome...

NodeJS errno 37 on socket.connect

I'm trying to connect to multiple hosts in succession, this is the code to resolve the ip address and socket.connect() to each domain name (line[1]). This works on it's own but returns an errno 37 error when run in quick succession with different hosts. The best information I have on the error is:
" code: 'EPROTO', description: 'protocol error' "
Code:
$.connect(port, line[1], function() {
this.write(request);
});
Error:
{ [Error: connect Unknown system errno 37]
code: 'Unknown system errno 37',
errno: 'Unknown system errno 37',
syscall: 'connect' }
How can I resolve this / why is this happening?
Thanks in advance.
EDIT: removed manual dns lookup code and added error report
duplicate with https://stackoverflow.com/questions/14672743/nodejs-crash-when-calling-socket-connect-in-quick-succession
Seems to me opening sockets in rapid succession is asking for trouble.
Try waiting in between opening the sockets and play with the amount of time needed to wait.

install mongodb with node.js: Cannot read property 'arbiterOnly' of undefined

I try to install remotely node.js + now.js + mongoDB on a newly created Ubuntu 11.04 system (64 bits).
I created a structure like this:
/home/xxx/server.js
/home/xxx/node/
/home/xxx/node_modules/now/
/home/xxx/http/index.html
No problem with node.js and now.js, it works just fine but I have a hard time trying to install and setup mongoDB.
I went to the root of my machine and installed Mongodb this way:
cd
sudo apt-get install mongodb
I don't know if I should but I created a data/db folder like this:
cd
mkdir /data/db
chown `id -u` /data/db
When done, I installed the mongodb driver for node on the appropriate folder:
cd /home/xxx/
npm install mongodb
Then I started the node server. My static page appears as it should but this is what I get on the ssh terminal after about 10 seconds:
[TypeError: Cannot read property 'arbiterOnly' of undefined]
TypeError: Cannot read property 'arbiterOnly' of undefined
at /home/xxx/node_modules/mongodb/lib/mongodb/connection/server.js:558:22
at [object Object].checkoutReader (/home/xxx/node_modules/mongodb/lib/mongodb/connection/server.js:575:16)
at /home/xxx/node_modules/mongodb/lib/mongodb/db.js:1344:79
at Db._executeQueryCommand (/home/xxx/node_modules/mongodb/lib/mongodb/db.js:1555:5)
at Cursor.nextObject (/home/xxx/node_modules/mongodb/lib/mongodb/cursor.js:455:13)
at Array.0 (/home/xxx/node_modules/mongodb/lib/mongodb/cursor.js:162:12)
at EventEmitter._tickCallback (node.js:192:40)
Tue Apr 24 2012 07:12:45 GMT+0200 (CEST) [GET] http://www.verysurf.com/proxyheader.php
error loading file httphttp://www.verysurf.com/proxyheader.php: { [Error: ENOENT, No such file or directory 'httphttp://www.verysurf.com/proxyheader.php']
errno: 33,
code: 'ENOENT',
path: 'httphttp://www.verysurf.com/proxyheader.php' }
What is this 'arbiterOnly' error message about?
What do I do wrong?
I googled this thing but there's not much to find about it.
And that "www.verysurf.com" url at the end of the error message, it's not always the same one. 5 minutes before I got this one (and I didn't change anything, just restarted the node server):
error loading file httphttp://59.53.91.9/proxy/judge.php: { [Error: ENOENT, No such file or directory 'httphttp://59.53.91.9/proxy/judge.php']
errno: 33,
code: 'ENOENT',
path: 'httphttp://59.53.91.9/proxy/judge.php' }
I really don't know what these url's are about.
Any help please?
Thank you.
I don't know why it's triggering that particular error message, but it looks to me like someone is or someones are sniffing your webserver to see if it's an open proxy (which it isn't). Some HTTP servers, notably Apache, are easily misconfigured to proxy any request to a third party:
http://en.wikipedia.org/wiki/Open_proxy
I get the very same message ([TypeError: Cannot read property 'arbiterOnly' of undefined]) when trying to request the database before the connection is fully initialized.
Make sure db.open() has finished (successfully)

Resources