Server Crashing in node.js - node.js

I am working on graphql(Apollo) with node server. I am getting an issue that my server is crashing if there is no request coming to the server for around 15 min.
I am getting following error in console
{ Error: read ETIMEDOUT
at exports._errnoException (util.js:1034:11)
at TCP.onread (net.js:584:26) code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'read' }
{ Error: read ETIMEDOUT
at exports._errnoException (util.js:1034:11)
at TCP.onread (net.js:584:26) code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'read' }
{ Error: read ETIMEDOUT
at exports._errnoException (util.js:1034:11)
at TCP.onread (net.js:584:26) code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'read' }
{ Error: read ETIMEDOUT
at exports._errnoException (util.js:1034:11)
at TCP.onread (net.js:584:26) code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'read' }
{ Error: read ETIMEDOUT
at exports._errnoException (util.js:1034:11)
at TCP.onread (net.js:584:26) code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'read' }
{ Error: read ETIMEDOUT
at exports._errnoException (util.js:1034:11)
at TCP.onread (net.js:584:26) code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'read' }
{ Error: read ETIMEDOUT
at exports._errnoException (util.js:1034:11)
at TCP.onread (net.js:584:26) code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'read' }
{ Error: read ETIMEDOUT
at exports._errnoException (util.js:1034:11)
at TCP.onread (net.js:584:26) code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'read' }
events.js:163
throw er; // Unhandled 'error' event
Is there any specific configuration missing in my configuration?

Related

Error: queryTxt ETIMEOUT cluster0.1si1c.mongodb.net

This error is showing up when I am trying to connect nodejs to mongodb atlas. Everything is fine and then it is happening:
Error: queryTxt ETIMEOUT cluster0.1si1c.mongodb.net
at QueryReqWrap.onresolve [as oncomplete] (node:dns:213:19) {
errno: undefined,
code: 'ETIMEOUT',
syscall: 'queryTxt',
hostname: 'cluster0.1si1c.mongodb.net'
}

ECONNREFUSED , I am trying to connect to my prosgres database running the app with nodemon

node:internal/process/promises:246
triggerUncaughtException(err, true /* fromPromise */);
^
Error: connect ECONNREFUSED 127.0.0.1:5432
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1161:16) {
errno: -61,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 5432
}

Discord js keyv throwing ECONNREFUSED

I'm trying to use Keyv, following this tutorial: https://discordjs.guide/keyv/#command-handler and I'm using the command handler code as well.
In my index.js, I run something like this: (with the appropriate imports for Keyv of course)
const Keyv = require('keyv');
const mykeyv = new Keyv('redis://user:pass#localhost:6379');
client.on('message', message =>{
...//skipping some command handler stuff
command.execute(message, args, mykeyv)
})
And then when I run this, I initially get the correct and expected client.on('ready') messages, but then a few seconds after the following error pops up:
events.js:292
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED 127.0.0.1:6379
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
Emitted 'error' event on Keyv instance at:
at KeyvRedis.<anonymous> (C:\Users\Meroper80\Documents\GitHub\DndBot\Node-Js-Discord-Bot\node_modules\keyv\src\index.js:43:44)
at KeyvRedis.emit (events.js:315:20)
at Redis.<anonymous> (C:\Users\Meroper80\Documents\GitHub\DndBot\Node-Js-Discord-Bot\node_modules\#keyv\redis\src\index.js:17:38)
at Redis.emit (events.js:315:20)
at Redis.silentEmit (C:\Users\Meroper80\Documents\GitHub\DndBot\Node-Js-Discord-Bot\node_modules\ioredis\built\redis\index.js:499:26)
at Socket.<anonymous> (C:\Users\Meroper80\Documents\GitHub\DndBot\Node-Js-Discord-Bot\node_modules\ioredis\built\redis\event_handler.js:186:14)
at Object.onceWrapper (events.js:422:26)
at Socket.emit (events.js:315:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 6379
}
I'm not sure what this error is about, can someone help me?

When I upload image in node, it throws ENOENT error

When I upload image in node , it throws ENOENT error:
Error: spawn identify ENOENT
at _errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn identify',
path: 'identify',
spawnargs: [ '-verbose', '-' ] }

node vault is not able to initialize and gives me the error Error: connect ECONNREFUSED 127.0.0.1:8200

The error is as shown below:
{ RequestError: Error: connect ECONNREFUSED 127.0.0.1:8200
at new RequestError (C:\Users\anand\quFlipApi\node_modules\request-promise\lib\errors.js:11:15)
at Request.RP$callback [as _callback] (C:\Users\anand\quFlipApi\node_modules\request-promise\lib\rp.js:60:32)
at self.callback (C:\Users\anand\quFlipApi\node_modules\request\request.js:188:22)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at Request.onRequestError (C:\Users\anand\quFlipApi\node_modules\request\request.js:884:8)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at Socket.socketErrorListener (_http_client.js:310:9)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at emitErrorNT (net.js:1276:8)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)
name: 'RequestError',
message: 'Error: connect ECONNREFUSED 127.0.0.1:8200',
cause:
{ Error: connect ECONNREFUSED 127.0.0.1:8200
at Object.exports._errnoException (util.js:1026:11)
at exports._exceptionWithHostPort (util.js:1049:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1085:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 8200 },
error:
{ Error: connect ECONNREFUSED 127.0.0.1:8200
at Object.exports._errnoException (util.js:1026:11)
at exports._exceptionWithHostPort (util.js:1049:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1085:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 8200 },
options:
{ method: 'PUT',
path: '/sys/init',
json: { secret_shares: 1, secret_threshold: 1 },
headers: { 'X-Vault-Token': undefined },
uri: 'http://127.0.0.1:8200/v1/sys/init',
simple: false,
resolveWithFullResponse: true,
callback: undefined,
transform: undefined },
response: undefined }
Connection with database succeeded.
The code for that is as shown below:
app.js
var options = {
apiVersion: 'v1', // default
endpoint: 'http://127.0.0.1:8200' // default
};
// get new instance of the client
var vault = require("node-vault")(options);
// init vault server
vault.init({ secret_shares: 1, secret_threshold: 1 })
.then((result) => {
var keys = result.keys;
// set token for all following requests
vault.token = result.root_token;
// unseal vault server
return vault.unseal({ secret_shares: 1, key: keys[0] })
})
.catch(console.error);
I have already removed clienttoken field to avoid any complexity, but still it is giving me the error.In this above code should I enter /remove any other field to make it work ?

Resources