Error: This socket has been ended by the other party - node.js

Am deploying one node js project in a linux evniroment everything is going fine ,but after 12 to 24 hours its throwing this error and app is not working ??
Error: This socket has been ended by the other party
at Socket.writeAfterFIN [as write] (net.js:275:12)
at Protocol.<anonymous> (/opt/node/node_modules/mysql/lib/Connection.js:69:27)
at Protocol.EventEmitter.emit (events.js:95:17)
at Protocol._emitPacket (/opt/node/node_modules/mysql/lib/protocol/Protocol.js:208:8)
at Query.<anonymous> (/opt/node/node_modules/mysql/lib/protocol/Protocol.js:121:12)
at Query.EventEmitter.emit (events.js:95:17)
at Query.start (/opt/node/node_modules/mysql/lib/protocol/sequences/Query.js:29:8)
at Protocol._startSequence (/opt/node/node_modules/mysql/lib/protocol/Protocol.js:262:14)
at Protocol._enqueue (/opt/node/node_modules/mysql/lib/protocol/Protocol.js:134:10)
at Connection.query (/opt/node/node_modules/mysql/lib/Connection.js:165:25)
--------------------
at Protocol._enqueue (/opt/node/node_modules/mysql/lib/protocol/Protocol.js:110:48)
at Connection.query (/opt/node/node_modules/mysql/lib/Connection.js:165:25)
at Object.query (/opt/node/api/database.js:78:16)
at Object.Wait.applyAndWait (/opt/node/node_modules/wait.for/waitfor.js:45:12)
at Object.Wait [as for] (/opt/node/node_modules/wait.for/waitfor.js:61:21)
at exports.getStories (/opt/node/api/stories.js:37:23)
at /opt/node/node_modules/wait.for/waitfor.js:15:31
Error: No default engine was specified and no extension was provided.
at new View (/opt/node/node_modules/express/lib/view.js:41:42)
at Function.app.render (/opt/node/node_modules/express/lib/application.js:486:12)
at ServerResponse.res.render (/opt/node/node_modules/express/lib/response.js:798:7)
at Object.errorHandler [as handle] (/opt/node/app.js:29:7)
at next (/opt/node/node_modules/express/node_modules/connect/lib/proto.js:188:17)
at Object.clientErrorHandler [as handle] (/opt/node/app.js:23:5)
at next (/opt/node/node_modules/express/node_modules/connect/lib/proto.js:188:17)
at Object.logErrors [as handle] (/opt/node/app.js:16:3)
at next (/opt/node/node_modules/express/node_modules/connect/lib/proto.js:188:17)
at next (/opt/node/node_modules/e
xpress/node_modules/connect/lib/proto.js:190:11
Dont know where I am wrong
Thanks in advance

Related

Error while compiling ejs, the error is on local system

Can anyone help me with below error.
I am getting this error on local but on server its working fine.
Have tried changing include ../PATH/files.ejs to include('../PATH/files.ejs') this removes error but not able to print content on that file.
SyntaxError: Unexpected token . in /PATH/index.ejs while compiling ejs
If the above error is not helpful, you may want to try EJS-Lint:
https://github.com/RyanZim/EJS-Lint
Or, if you meant to create an async function, pass `async: true` as an option.
at new Function (<anonymous>)
at Template.compile (/PATH/node_modules/ejs/lib/ejs.js:626:12)
at Object.compile (/PATH/node_modules/ejs/lib/ejs.js:366:16)
at handleCache (/PATH/node_modules/ejs/lib/ejs.js:215:18)
at tryHandleCache (/PATH/node_modules/ejs/lib/ejs.js:254:16)
at View.exports.renderFile [as engine] (/PATH/node_modules/ejs/lib/ejs.js:459:10)
at View.render (/PATH/node_modules/express/lib/view.js:135:8)
at tryRender (/PATH/node_modules/express/lib/application.js:640:10)
at Function.render (/PATH/node_modules/express/lib/application.js:592:3)
at ServerResponse.render (/PATH/node_modules/express/lib/response.js:1012:7)
at ServerResponse.res.render (/PATH/node_modules/express-ejs-layouts/lib/express-layouts.js:77:18)
at res_data (/PATH/front_system.js:248:17)
at /PATH/front_system.js:218:13
at Layer.handle [as handle_request] (/PATH/node_modules/express/lib/router/layer.js:95:5)
at next (/PATH/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/PATH/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/PATH/node_modules/express/lib/router/layer.js:95:5)
at /PATH/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/PATH/node_modules/express/lib/router/index.js:335:12)
at next (/PATH/node_modules/express/lib/router/index.js:275:10)
at jsonParser (/PATH/node_modules/body-parser/lib/types/json.js:110:7)
at Layer.handle [as handle_request] (/PATH/node_modules/express/lib/router/layer.js:95:5)
Resolved by changing:
From
<% include ../PATH/files.ejs %>
To
<%- include('../PATH/files.ejs') %>

Parameter error with a script tag and alert

I am getting the following error showing up in my logger.
URIError: Failed to decode param '/%db<script>alert(539043);</script>/'
at decodeURIComponent (<anonymous>)
at decode_param (/usr/src/app/node_modules/express/lib/router/layer.js:172:12)
at Layer.match (/usr/src/app/node_modules/express/lib/router/layer.js:123:27)
at matchLayer (/usr/src/app/node_modules/express/lib/router/index.js:574:18)
at next (/usr/src/app/node_modules/express/lib/router/index.js:220:15)
at app.use (/usr/src/app/app.js:83:9)
at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:317:13)
at /usr/src/app/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:335:12)
I think this is someone trying to probe my site for some vulnerability. This occurs 2 times every week like clockwork.
Around the same time I get the following error too:
URIError: Failed to decode param '/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/etc/passwd'
at decodeURIComponent (<anonymous>)
at decode_param (/usr/src/app/node_modules/express/lib/router/layer.js:172:12)
at Layer.match (/usr/src/app/node_modules/express/lib/router/layer.js:123:27)
at matchLayer (/usr/src/app/node_modules/express/lib/router/index.js:574:18)
at next (/usr/src/app/node_modules/express/lib/router/index.js:220:15)
at app.use (/usr/src/app/app.js:83:9)
at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:317:13)
at /usr/src/app/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:335:12)
Is there some sort of way to prevent this? Should I be concerned about this? Is there a standard way of dealing with parameters that are not legitimate.

jhipster:entity error in jhispter:client or server app

I created an app with jhipster:client and another one with :server and tried to generate an entity 'client only' in the client app but I'm getting:
'events.js:163
throw er; // Unhandled 'error' event
^
TypeError: Cannot read property 'endsWith' of undefined
at constructor.getAngularAppName (/Users/ndjordjevic/IdeaProjects/jh-client-jwt/node_modules/generator-jhipster/generators/generator-base.js:1604:65)
at constructor.getConfig (/Users/ndjordjevic/IdeaProjects/jh-client-jwt/node_modules/generator-jhipster/generators/entity/index.js:160:40)
at Object.<anonymous> (/Users/ndjordjevic/IdeaProjects/jh-client-jwt/node_modules/yeoman-generator/lib/index.js:417:23)
at /Users/ndjordjevic/IdeaProjects/jh-client-jwt/node_modules/run-async/index.js:25:25
at /Users/ndjordjevic/IdeaProjects/jh-client-jwt/node_modules/run-async/index.js:24:19
at /Users/ndjordjevic/IdeaProjects/jh-client-jwt/node_modules/yeoman-generator/lib/index.js:418:9
at runCallback (timers.js:672:20)
at tryOnImmediate (timers.js:645:5)
at processImmediate [as _immediateCallback] (timers.js:617:5)'
It works in 'server only' app.
Generating entities are only for 'full apps'?

ERR wrong number of arguments for 'hmset' command

I have the following code:
setOnOrder = (map) ->
console.log map
if _.isEmpty map
Promise.resolve()
else
hmsetPr "onorder.tmp", map
onOrder = (req, res, next) ->
console.log req.query
if req.query.syncStart
delPr "onorder.tmp"
.then -> sendOK(res)
.catch next
else if req.query.syncComplete
renamePr("onorder.tmp", "onorder")
.then -> sendOK(res)
.catch next
else
onOrderMap = _(req.body)
.groupBy( (r) -> r.sku )
.mapValues( (v) -> JSON.stringify(v) )
.value()
console.log "sync.onorder #{_.size(onOrderMap)} skus"
setOnOrder onOrderMap
.then -> sendOK(res)
.catch next
where map is like:
{ 'N52Z-LH1': '[{"doCref":"E3320","doAccount":"EVE001","sku":"N52Z-LH1","crDate":"20150703","crTime":"09:52:52","reqQty":150,"recQty":0,"reqDate":"20150703","recDate":"","cmpLtd":"F"}]',
'N52Z-LH2': '[{"doCref":"E3320","doAccount":"EVE001","sku":"N52Z-LH2","crDate":"20150703","crTime":"09:52:52","reqQty":150,"recQty":0,"reqDate":"20150703","recDate":"","cmpLtd":"F"}]',
'N52Z-LH3': '[{"doCref":"E3320","doAccount":"EVE001","sku":"N52Z-LH3","crDate":"20150703","crTime":"09:52:52","reqQty":150,"recQty":0,"reqDate":"20150703","recDate":"","cmpLtd":"F"}]',
'N54Z-BL1': '[{"doCref":"E3320","doAccount":"EVE001","sku":"N54Z-BL1","crDate":"20150703","crTime":"09:52:52","reqQty":100,"recQty":0,"reqDate":"20150703","recDate":"","cmpLtd":"F"}]',
'SA01-MGR1': '[{"doCref":"E3321","doAccount":"ARM001","sku":"SA01-MGR1","crDate":"20150703","crTime":"15:47:52","reqQty":160,"recQty":0,"reqDate":"20150703","recDate":"","cmpLtd":"F"}]',
'SA01-MGR2': '[{"doCref":"E3321","doAccount":"ARM001","sku":"SA01-MGR2","crDate":"20150703","crTime":"15:47:52","reqQty":320,"recQty":0,"reqDate":"20150703","recDate":"","cmpLtd":"F"}]',
'SA01-MGR3': '[{"doCref":"E3321","doAccount":"ARM001","sku":"SA01-MGR3","crDate":"20150703","crTime":"15:47:52","reqQty":320,"recQty":0,"reqDate":"20150703","recDate":"","cmpLtd":"F"}]',
'SA01-MGR4': '[{"doCref":"E3321","doAccount":"ARM001","sku":"SA01-MGR4","crDate":"20150703","crTime":"15:47:52","reqQty":240,"recQty":0,"reqDate":"20150703","recDate":"","cmpLtd":"F"}]',
'SA01-MGR5': '[{"doCref":"E3321","doAccount":"ARM001","sku":"SA01-MGR5","crDate":"20150703","crTime":"15:47:52","reqQty":80,"recQty":0,"reqDate":"20150703","recDate":"","cmpLtd":"F"}]',
'SA01-MPL3': '[{"doCref":"E3321","doAccount":"ARM001","sku":"SA01-MPL3","crDate":"20150703","crTime":"15:47:53","reqQty":240,"recQty":0,"reqDate":"20150703","recDate":"","cmpLtd":"F"}]',
'SA02-MNA1': '[{"doCref":"E3322","doAccount":"ARM001","sku":"SA02-MNA1","crDate":"20150703","crTime":"15:49:59","reqQty":200,"recQty":0,"reqDate":"20150703","recDate":"","cmpLtd":"F"}]',
'SA02-MNA2': '[{"doCref":"E3322","doAccount":"ARM001","sku":"SA02-MNA2","crDate":"20150703","crTime":"15:49:59","reqQty":300,"recQty":0,"reqDate":"20150703","recDate":"","cmpLtd":"F"}]',
'SA02-MNA3': '[{"doCref":"E3322","doAccount":"ARM001","sku":"SA02-MNA3","crDate":"20150703","crTime":"15:49:59","reqQty":200,"recQty":0,"reqDate":"20150703","recDate":"","cmpLtd":"F"}]',
'SA40-MBL5': '[{"doCref":"E3323","doAccount":"ARM001","sku":"SA40-MBL5","crDate":"20150703","crTime":"15:51:46","reqQty":25,"recQty":0,"reqDate":"20150703","recDate":"","cmpLtd":"F"}]',
'SA40-MNA5': '[{"doCref":"E3323","doAccount":"ARM001","sku":"SA40-MNA5","crDate":"20150703","crTime":"15:51:46","reqQty":25,"recQty":0,"reqDate":"20150703","recDate":"","cmpLtd":"F"}]' }
but everytime i try to set it in redis, I get the following traceback:
http://localhost:3000/sync/onorder Error: ERR wrong number of arguments for 'hmset' command
at JavascriptReplyParser._parseResult (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/redis/lib/parsers/javascript.js:43:16)
at JavascriptReplyParser.try_parsing (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/redis/lib/parsers/javascript.js:114:21)
at JavascriptReplyParser.run (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/redis/lib/parsers/javascript.js:126:22)
at JavascriptReplyParser.execute (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/redis/lib/parsers/javascript.js:107:10)
at Socket.<anonymous> (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/redis/index.js:131:27)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at Socket.Readable.push (_stream_readable.js:110:10)
at TCP.onread (net.js:523:20)
From previous event:
at ret (<anonymous>:8:21)
at setOnOrder (/home/khine/Sandboxes/node-blade-boiler-template/app/controllers/sync.coffee:277:5)
at onOrder (/home/khine/Sandboxes/node-blade-boiler-template/app/controllers/sync.coffee:295:5)
at Layer.handle [as handle_request] (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/express/lib/router/layer.js:95:5)
at next (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/express/lib/router/layer.js:95:5)
at /home/khine/Sandboxes/node-blade-boiler-template/node_modules/express/lib/router/index.js:277:22
at Function.process_params (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/express/lib/router/index.js:330:12)
at next (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/express/lib/router/index.js:271:10)
at Function.handle (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/express/lib/router/index.js:176:3)
at router (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/express/lib/router/index.js:46:12)
at Layer.handle [as handle_request] (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/express/lib/router/index.js:312:13)
at /home/khine/Sandboxes/node-blade-boiler-template/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/express/lib/router/index.js:330:12)
at next (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/express/lib/router/index.js:271:10)
at urlencodedParser (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/body-parser/lib/types/urlencoded.js:81:44)
at Layer.handle [as handle_request] (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/express/lib/router/index.js:312:13)
at /home/khine/Sandboxes/node-blade-boiler-template/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/express/lib/router/index.js:330:12)
at next (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/express/lib/router/index.js:271:10)
at /home/khine/Sandboxes/node-blade-boiler-template/node_modules/body-parser/lib/read.js:129:5
at invokeCallback (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/body-parser/node_modules/raw-body/index.js:262:16)
at done (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/body-parser/node_modules/raw-body/index.js:251:7)
at Gunzip.onEnd (/home/khine/Sandboxes/node-blade-boiler-template/node_modules/body-parser/node_modules/raw-body/index.js:308:7)
at emitNone (events.js:72:20)
at Gunzip.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:905:12)
at doNTCallback2 (node.js:441:9)
at process._tickDomainCallback (node.js:396:17)
any advise on how to resolve this issue?
The issue was I had null values

plunker node js jitsu error when start application

I getting errors during start jitsu server.
Please guide me
{"message":"Object #<ServerResponse> has no method 'local'","code":500}
err Mon, 11 Nov 2013 13:13:09 GMT TypeError: Object # has no method 'local'
at Object.module.exports.middleware [as handle]
(/opt/run/snapshot/package/servers/www/middleware/expose.coffee:3:5)
at next (/opt/run/snapshot/package/node_modules/express/node_modules/connect/lib/proto.js:193:15)
at multipart (/opt/run/snapshot/package/node_modules/express/node_modules/connect/lib/middleware/multipart.js:90:37)
at module.exports
(/opt/run/snapshot/package/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js:57:9)
at urlencoded (/opt/run/snapshot/package/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js:49:37)
at module.exports
(/opt/run/snapshot/package/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js:55:7)
at json (/opt/run/snapshot/package/node_modules/express/node_modules/connect/lib/middleware/json.js:51:37)
at Object.bodyParser [as handle]
(/opt/run/snapshot/package/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js:53:5)
at next (/opt/run/snapshot/package/node_modules/express/node_modules/connect/lib/proto.js:193:15)
at Object.cookieParser [as handle]
(/opt/run/snapshot/package/node_modules/express/node_modules/connect/lib/middleware/cookieParser.js:60:5)
at next (/opt/run/snapshot/package/node_modules/express/node_modules/connect/lib/proto.js:193:15)
at Object.exports.send [as oncomplete]
(/opt/run/snapshot/package/node_modules/connect/lib/middleware/static.js:139:11)
You want res.locals (plural) not res.local
Since this is still not clear enough for #Marco,
open expose.coffee in your text editor
on line 3, change the word "local" to "locals"
save and retry

Resources