canvasengine Tiled_server Error: ENOENT, open './map.json' - node.js

This is my problem:
I try start Canvasengine example server and I get this error.
root#vps185158:/# node /var/www/canvas/canvasengine/examples/tiled_server/server/server.js
info - socket.io started
debug - client authorized
info - handshake authorized ogjRNMePBqcD_ZIkFVFK
debug - setting request GET /socket.io/1/websocket/ogjRNMePBqcD_ZIkFVFK
debug - set heartbeat interval for client ogjRNMePBqcD_ZIkFVFK
debug - client authorized for
debug - websocket writing 1::
/node_modules/canvasengine/core/engine-common.js:373
if (err) throw err;
^
Error: ENOENT, open './map.json'
at Error (native)
map.json is there, but nodejs can't find that file.
Server have Debian 7, nodejs, Socket.io and CanvasEngine 1.3.0

Looking at the code, you should either copy map.json to your working directory (which seems to be /, so I wouldn't necessarily recommend that) or start the server from its respective directory:
$ cd /var/www/canvas/canvasengine/examples/tiled_server/server/
$ node server
(although this may require setting $NODE_PATH)

Related

WebSocket not running on live domain node server while live server running .but running on localhost node server. Please need to solve

(index):116 Uncaught DOMException: Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.
at HTMLFormElement. (http://apppanel.fitnfurious.in/chatm/m/:116:8)enter image description here

Parse Server + Express - Issues with ParseError and site dying/restarting

I have deployed a Bitnami Parse stack to a Google Cloud VM. This stack is basically Apache running as a proxy, Then a MEAN stack handling parse server and dashboard etc.
Everything appears to be working fine when accessing the dashboard and sending individual CURL requests to test it's all available.
However, there appears to be a fatal flaw in that. When Parse returns one of it's errors e.g.
{"code":101,"error":"Object not found."}
Express sees it as an uncaught exception and dies. Now I realise that it's intentional behaviour (There's enough information out there as to why you don't want to persist after an uncaught exception)
The Bitnami stack uses Forever to run the Parse Server, but as you can see from the logs I will include below, you still run into issues with refused connections.
2016-11-25T11:41:16+00:00 DEBUG (7): {"code":101,"error":"Object not found."}
2016-11-25T11:41:16+00:00 DEBUG (7): Failed to connect to X.X.X.X: Connection refused
2016-11-25T11:41:17+00:00 DEBUG (7): Failed to connect to X.X.X.X: Connection refused
2016-11-25T11:41:17+00:00 DEBUG (7): Failed to connect to X.X.X.X: Connection refused
2016-11-25T11:41:17+00:00 DEBUG (7): Failed to connect to X.X.X.X: Connection refused
Meanwhile in the Forever logs:
Error generating response. ParseError { code: 101, message: 'Object not found.' } code=101, message=Object not found.
[object Object]
/opt/bitnami/apps/parse/htdocs/node_modules/parse-server/lib/ParseServer.js:425
throw err;
^
Error: EACCES: permission denied, open '/opt/bitnami/apps/parse/htdocs/logs/parse-server.info.2016-11-25'
at Error (native)
error: Forever detected script exited with code: 7
error: Script restart attempt #1
parse-server running on port 1337
parse-dashboard running on port 4040
So you can see that immediately following a Parse error being returned, The service is unavailable until Forever can restart the Parse Server.
This issue appears that it would affect all users as well, so if one user receives an exception, all users lose connection for a brief period.
So the question is, how should this be properly handled? Is Parse + Express not the way to go about it? Or is there some method of configuring Node or Express to return the API error to the requester, without Express dying (And without having to fall into the trap of using uncaughtException to keep Node alive)
Any help would be much appreciated, thank you
The logs from Forever said it's EACCES error, that means ParseServer couldn't access the log file and not able to write the info log in it.
Error: EACCES: permission denied, open '/opt/bitnami/apps/parse/htdocs/logs/parse-server.info.2016-11-25'
at Error (native)
error: Forever detected script exited with code: 7
error: Script restart attempt #1
parse-server running on port 1337
parse-dashboard running on port 4040
I think you have to change the /opt/bitnami/apps/parse/htdocs/logs with proper permission so that ParseServer can write log files in it.

Nodejs to Couchbase Server timed out

My app is actually running fine when I started it and keep an eye on it for few hours.
BUT later time(I'm not sure what exact time of inactivity), It does show "Server timed out" (I crop some logs below)
[ERROR] (server - L:463) <node.mycouchbase.server:11210> (SRV=0x2111c60,IX=4) Server timed out. Some commands have failed
[INFO] (confmon - L:166) Not applying configuration received via CCCP. No changes detected. A.rev=152466, B.rev=152466
[INFO] (cccp - L:110) Re-Issuing CCCP Command on server struct 0x2116980
[ERROR] (cccp - L:133) <NOHOST:NOPORT> Got I/O Error=0x17
[INFO] (cccp - L:110) Re-Issuing CCCP Command on server struct 0x2185e30
All just working fine again when I restart my Node.js app (Expressjs app).
This problem seem regularly happening
Please give me some suggestion what could be actually problems behind.
Thanks

Socket.IO and Node.js Core Cluster

Is it possible to use Socket.IO with Node's core cluster (not the outdated module)?
I can fork multiple workers and it seems to work fine; however, when opening a connection I get the error: solve: warn - client not handshaken client should reconnect
Here's the relevant code snippet (with a few simple things like expressjs config removed):
if ( cluster.isMaster ) {
for ( var i = 0; i < numCPUs; i++ ) {
cluster.fork();
}
} else {
app.get('/', function (req, res) {
res.sendfile( __dirname + '/public/html/index.html' );
});
io.configure( function() {
var RedisStore = require('socket.io').RedisStore,
opts = { host: 'localhost', port: 8888 };
io.set('store', new RedisStore( { redisPub: opts, redisSub: opts, redisClient: opts } ));
});
app.listen( 8888 );
io.sockets.on('connection', function (socket) {
socket.emit( 'some', 'data' );
});
}
I've tried with and without using RedisStore and with the trick on this site (which I believe is obsolete now): http://www.danielbaulig.de/socket-ioexpress/
I've also looked at the code at http://www.ranu.com.ar/2011/11/redisstore-and-rooms-with-socketio.html, although I don't see how that code is any different than using MemoryStore.
All of my test connections are using Websockets (RFC 6455). This works fine if I set numCPUs to equal 1.
Node.js version 0.6.17
Socket.io version 0.9.5
Expressjs version 2.5.9
Update - include console output (note, on this attempt the connection did ultimately work, although it threw the same errors):
info - socket.io started
info - socket.io started
info - socket.io started
info - socket.io started
info - socket.io started
debug - served static content /socket.io.js
debug - client authorized
info - handshake authorized 17644195072103946664
debug - setting request GET /socket.io/1/websocket/17644195072103946664
debug - set heartbeat interval for client 17644195072103946664
debug - websocket writing 7:::1+0
warn - client not handshaken client should reconnect
info - transport end (error)
debug - set close timeout for client 17644195072103946664
debug - cleared close timeout for client 17644195072103946664
debug - cleared heartbeat interval for client 17644195072103946664
debug - discarding transport
debug - client authorized
info - handshake authorized 16098526291524652257
debug - setting request GET /socket.io/1/websocket/16098526291524652257
debug - set heartbeat interval for client 16098526291524652257
debug - websocket writing 7:::1+0
warn - client not handshaken client should reconnect
info - transport end (error)
debug - set close timeout for client 16098526291524652257
debug - cleared close timeout for client 16098526291524652257
debug - cleared heartbeat interval for client 16098526291524652257
debug - discarding transport
debug - client authorized
info - handshake authorized 13419993801561067603
debug - setting request GET /socket.io/1/websocket/13419993801561067603
debug - set heartbeat interval for client 13419993801561067603
debug - client authorized for
debug - websocket writing 1::
debug - websocket writing 5:::{"some":"data","args":[11354]}
debug - websocket writing 5:::{"some":"data","args":[36448]}
This is how the console output ends on a failure (fails about 9 times out of 10):
info - transport end by forced client disconnection
debug - websocket writing 0::
info - transport end (booted)
debug - set close timeout for client 1639301251431944437
debug - cleared close timeout for client 1639301251431944437
debug - cleared heartbeat interval for client 1639301251431944437
debug - discarding transport
debug - got disconnection packet
debug - got disconnection packet
Update - Added links to possible tickets on github:
https://github.com/LearnBoost/socket.io/issues/881
https://github.com/LearnBoost/socket.io/issues/438
It seems the issue may be related to the node module that Socket.IO comes installed with.
When I installed redis (npm install hiredis redis) and created the clients for the RedisStore using the redis module, everything suddenly worked perfectly. I've been running for over an hour with ~500 concurrent connections and haven't seen a single error, and every node process is being utilized.
hiredis#0.1.14
redis#0.7.2
Running Redis 2.6rc3 on port 6379.
Update: In Node.s 0.8, it looks like the cluster library should be considerably more mature, so the above code/issues will probably become obsolete: http://nodejs.org/docs/v0.7.8/api/cluster.html

Error: Connection refused issue when trying to connect to a mqtt enabled node server hosted on heroku

So I basically wanted to host a mqtt pub/sub-enabled node server on Heroku. These are 2 guides I refer to:
https://github.com/adamvr/MQTT.js and https://gist.github.com/1826931
The mqtt pub/sub worked well when tested on localhost, deployment on heroku was fine, but when I tried testing on Heroku it didn't work
I tried 2 commands to subscribe, both showed the same errors.
Command 1:
mosquitto_sub -p <port> -h <host> -t <topic>
Error 1:
Error: Connection refused
Unable to connect (13).
Command 2:
mqtt_sub <port> <host> <topic>
Error 2:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: connect ECONNREFUSED
at errnoException (net.js:670:11)
at Object.afterConnect [as oncomplete] (net.js:661:19)
My main.js (server) code is similar to this one - https://gist.github.com/1826931. The error seems more like a node problem than a mqtt pub/sub problem, and I am new to node, so not quite sure how to debug it. I put in some console.log lines but as expected it didn't print since it's not connected. There is a dyno running node main.js on Heroku fine.
Process State Command
------- ---------- ------------
web.1 up for 35m node main.js
Appreciate any advice on this issue.

Resources