Graphdat NodeJS - Connection failed ENOENT - node.js

I tried using Graphdat NodeJS module to monitor my we app but I'm encountering a problem.
My server is running in a Amazon EC2 instance, Ubuntu 12.10 x64.
When I start my node app it prints
Graphdat Info: Graphdat (v0.4.6) is enabled
Graphdat Info: Will send to agent on /tmp/gd.agent.sock
But as soon as I load the page in the browser it prints
Graphdat Error: gd.agent.sync: connection failed (/tmp/gd.agent.sock): { [Error: connect ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'connect' }

Found it. The script provided to install the logger was not successfully installed and it wasn't running.
curl -s -d '{"token":"api.xxxxxxxx"}' -H 'Content-Type: application/json' https://dashboard.graphdat.com/agent/install | sh

Related

"vitest --ui" causing "Error: spawn xdg-open ENOENT"

I'm trying to check out Vitest's fancy UI server in my node docker container. But can't get it up and running. When running the npm script vitest --ui I get a node error spawn xdg-open ENOENT.
Here the full error message:
$ npm run test-ui
> wpvite#0.0.0 test-ui
> vitest --ui
DEV v0.23.4 /home/node/apps/main/frontend
UI started at http://localhost:51204/__vitest__/
node:events:491
throw er; // Unhandled 'error' event
^
Error: spawn xdg-open ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn xdg-open',
path: 'xdg-open',
spawnargs: [ 'https://localhost:51204/__vitest__/' ]
}
Node.js v18.10.0
Google is no help at all - nothing related to Vitest even close. Also I'm obviously not a Node.js expert.
Even though the Node.js error message appears pretty cryptic to me, I still was lucky to use Ubuntu as my primary OS (beside macOS) which made me draw my attention to xdg-open in the error message - I occasionally use the command to open all kind of programs/apps on Ubuntu. Don't know why, but you need to have xdg-open installed on your system, to be able to run vitest --ui, even though it's neither mentioned in Vitest nor in Vite Github repos with a single word. Anyway for debian based containers it's:
apt install xdg-utils --fix-missing
Allthough this made the ENOENT error go away and the UI server starts up without errors, I still don't get to see the UI app due to some runtime-dom errors... I give it up. But maybe someone else finds the xdg-open info helpful.
UPDATE: It's working!
I just had to append /__vitest__/ to my proxied local url as clearly described in the docs:
"Then you can visit the Vitest UI at http://localhost:51204/__vitest__/"

ONLYOFFICE Developer Edition demo issue - error downloadFile

I installed and run OnlyOffice docker image on my local windows machine with this command:
docker run -i -t -d -p 9950:80 --restart=always -v C:/work/only_office/logs:/var/log/onlyoffice onlyoffice/documentserver-de
Then run commands described on this page - http://localhost:9950/welcome/ for testing OnlyOffilce:
docker exec 2a9aa47c18a2 sudo supervisorctl start ds:example
docker exec 2a9aa47c18a2 sudo sed "s,autostart=false,autostart=true," -i /etc/supervisor/conf.d/ds-example.conf
This page - http://localhost:9950/example/ starts working. But when I try to create, open or upload document I am getting this error:
And errors in the log files:
[2020-07-07T12:30:24.892] [ERROR] nodeJS - error downloadFile:url=http://127.0.0.1:9950/example/files/172.17.0.1/new%20(2).docx;attempt=1;code:ECONNREFUSED;connect:null;(id=172.17.0.1http___127.0.0.1_9950_example_files_172.17.0.1_new_20_2_.docx1594125018845)
Error: connect ECONNREFUSED 127.0.0.1:9950
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)
[2020-07-07T12:30:25.894] [ERROR] nodeJS - error downloadFile:url=http://127.0.0.1:9950/example/files/172.17.0.1/new%20(2).docx;attempt=2;code:ECONNREFUSED;connect:null;(id=172.17.0.1http___127.0.0.1_9950_example_files_172.17.0.1_new_20_2_.docx1594125018845)
Error: connect ECONNREFUSED 127.0.0.1:9950
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)
[2020-07-07T12:30:26.897] [ERROR] nodeJS - error downloadFile:url=http://127.0.0.1:9950/example/files/172.17.0.1/new%20(2).docx;attempt=3;code:ECONNREFUSED;connect:null;(id=172.17.0.1http___127.0.0.1_9950_example_files_172.17.0.1_new_20_2_.docx1594125018845)
Error: connect ECONNREFUSED 127.0.0.1:9950
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)
[2020-07-07T12:30:24.881] [ERROR] nodeJS - postData error: docId = 172.17.0.1http___127.0.0.1_9950_example_files_172.17.0.1_new_20_2_.docx1594125018845;url = http://127.0.0.1:9950/example/track?filename=new%20(2).docx&useraddress=172.17.0.1;data = {"key":"172.17.0.1http___127.0.0.1_9950_example_files_172.17.0.1_new_20_2_.docx1594125018845","status":1,"users":["uid-1"],"actions":[{"type":1,"userid":"uid-1"}]}
Error: connect ECONNREFUSED 127.0.0.1:9950
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)
I tried to switch off firewall and test it on another Windows PC but the issue is the same. Any ideas how to fix it?
Check this one out. Seems like some process is running on the port you are using. Try switching your ports.
References:
"The ECONNREFUSED Connection refused by the server error, is a common error returned by the Filezilla FTP client. This error indicates that the user is trying to connect to your server and is unable to connect to the port."
https://community.progress.com/s/article/Connection-Error-ECONNREFUSED-Connection-refused-by-the-server
ECONNREFUSED on running localhost server from NodeJS
Node.js Error: connect ECONNREFUSED
I had the same problem and after trying for a while I just try following the documentation and it worked, you have to run the docker image in port 80, that will solve the error.
docker run -i -t -d -p 80:80 --restart=always -v C:/work/only_office/logs:/var/log/onlyoffice onlyoffice/documentserver-de
I'm searching for change the port in a proper way. Let me know if you find out.
According to support's answer the current last version (5.5.3) of OnlyOffice is not working on Windows docker:
Unfortunately, at the moment we do not recommend using this method of
installing Document Server. If you would like to use a docker
installation, please use this Document Server installation guide on
*NIX systems.
I run docker image on CentOs server. Now everything is working as expected.

Node Agenda Scheduler Mongo errno: 20, code: 'EMFILE'

I am running a node scheduler using agenda. It runs fine for around 30 minutes and then it starts displaying this error.
{ [Error: EMFILE, open 'log/scheduler.log'] errno: 20, code: 'EMFILE', path: 'log/scheduler.log' }
{ [Error: EMFILE, open 'log/scheduler.log'] errno: 20, code: 'EMFILE', path: 'log/scheduler.log' }
[Error: failed to connect to [localhost:27017]]
[Error: failed to connect to [localhost:27017]]
[Error: failed to connect to [localhost:27017]]
[Error: failed to connect to [localhost:27017]]
[Error: failed to connect to [localhost:27017]]
I am using node js with mongo db deployed on a EC2 instance.
The code I wrote is here:
https://github.com/kelvinblade/bluesky-scheduler2
Any help would be appreciated.
EMFILE occurs when too many file descriptors are open as there is limitation in an os for the number of descriptors to be opened by a process.
You can reset this restriction by editing this file
/etc/sysctl.conf
or a more graceful approach is to use some module that would take care and have a connectionpool to monitor over the opened file descriptors.
You may try node-graceful-fs or filequeue
Git source :
https://github.com/isaacs/node-graceful-fs
https://github.com/treygriffith/filequeue.git
Install apppropriate node modules by
npm install node-graceful-fs
or
npm install filequeue
and replace your fs from default to
var fs = require('graceful-fs')
or
var fs = new FileQueue(100);
Personally i feel filequeue is better queuing system.

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)

Problems with RailwayJS (node.js): Redis connection to localhost:6379 failed - connect ECONNREFUSED

I found this web framework for node.js similar to Rails: http://railwayjs.com/
I followed all the steps:
sudo npm install railway -g
railway init blog && cd blog
npm install -l
railway generate crud post title content
# ensure mongodb is running
railway server 8888
open http://127.0.0.1:8888/posts
But I'm getting this error when I start the server:
alex#alex-System-Product-Name:~/blog$ sudo status mongodb
mongodb start/running, process 5836
alex#alex-System-Product-Name:~/blog$ railway server 8888
The "sys" module is now called "util". It should have a similar interface.
Railway server listening on port 8888 within development environment
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Redis connection to localhost:6379 failed - connect ECONNREFUSED
at RedisClient.on_error (/home/alex/blog/node_modules/railway/node_modules/jugglingdb/node_modules/redis/index.js:136:24)
at Socket.<anonymous> (/home/alex/blog/node_modules/railway/node_modules/jugglingdb/node_modules/redis/index.js:70:14)
at Socket.emit (events.js:67:17)
at Array.0 (net.js:299:25)
at EventEmitter._tickCallback (node.js:192:40)
Does anyone knows what's the problem?
I had to install Redis for Ubuntu (the OS I was using).
Then run redis-server in the terminal.

Resources