got packets out of order. Expected 3 but received 0 - javascript

server is crashing automatically and showing this error. can you guys please me to get out from this problem>>>>
Warning: got packets out of order. Expected 3 but received 0
node:events:368
throw er; // Unhandled 'error' event
^
Error: The client was disconnected by the server because of inactivity. See wait_timeout and interactive_timeout for configuring this behavior.
at Connection.protocolError (/home/abroadinquiry/server/node_modules/mysql2/lib/connection.js:394:17)
at Connection.handlePacket (/home/abroadinquiry/server/node_modules/mysql2/lib/connection.js:445:14)
at PacketParser.onPacket (/home/abroadinquiry/server/node_modules/mysql2/lib/connection.js:85:12)
at PacketParser.executeStart (/home/abroadinquiry/server/node_modules/mysql2/lib/packet_parser.js:75:16)
at Socket. (/home/abroadinquiry/server/node_modules/mysql2/lib/connection.js:92:25)
at Socket.emit (node:events:390:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at TCP.onStreamRead (node:internal/stream_base_commons:199:23)
Emitted 'error' event on Connection instance at:
at Connection.protocolError (/home/abroadinquiry/server/node_modules/mysql2/lib/connection.js:397:10)
at Connection.handlePacket (/home/abroadinquiry/server/node_modules/mysql2/lib/connection.js:445:14)
[... lines matching original stack trace ...]
at TCP.onStreamRead (node:internal/stream_base_commons:199:23) {
fatal: true,
code: 4031

Related

React js Project - node:events: throw er; //Unhandled 'error' event

node:events:491
throw er; // Unhandled 'error' event
^
TypeError: Cannot set property closed of #<Readable> which has only a getter
at FsReadStream.close (/app/node_modules/memfs/lib/volume.js:2047:17)
at FsReadStream._destroy (/app/node_modules/memfs/lib/volume.js:2032:10)
at _destroy (node:internal/streams/destroy:109:10)
at class_1.destroy (node:internal/streams/destroy:71:5)
at class_1.<anonymous> (/app/node_modules/memfs/lib/volume.js:1962:22)
at class_1.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1359:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on class_1 instance at:
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Node.js v18.9.0
I double checked try catch block all over the project where promises used.
Added Error Bounderies to solve this issue but still my server crashed on this error.
I have faced the same issue.
nmp i memfs#latest
Resolved my issue.

Getting This Error When Trying To Connect To MongoDB database

codeNot sure why Im getting this error as it was working the last time I opened my project but this is what I get when I attempt to connect to my database.mongo error,jpg
Error Code
PS C:\Users\Joseph\Desktop\server> node server.js
Server is running on port:${port}
(node:18576) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to
the MongoClient constructor.
(Use `node --trace-deprecation ...` to show where the warning was created)
C:\Users\Joseph\Desktop\node_modules\mongodb\lib\core\topologies\server.js:438
new MongoNetworkError(
^
MongoNetworkError: failed to connect to server [cluster0-shard-00-02.qqrcr.mongodb.net:27017] on first connect [MongoError: bad auth : Authentication failed.
at Connection.messageHandler (C:\Users\Joseph\Desktop\node_modules\mongodb\lib\core\connection\connection.js:359:19)
at Connection.emit (node:events:379:20)
at processMessage (C:\Users\Joseph\Desktop\node_modules\mongodb\lib\core\connection\connection.js:451:10)
at TLSSocket.<anonymous> (C:\Users\Joseph\Desktop\node_modules\mongodb\lib\core\connection\connection.js:620:15)
at TLSSocket.emit (node:events:379:20)
at addChunk (node:internal/streams/readable:313:12)
at readableAddChunk (node:internal/streams/readable:288:9)
at TLSSocket.Readable.push (node:internal/streams/readable:227:10)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
ok: 0,
code: 8000,
codeName: 'AtlasError'
}]
at Pool.<anonymous> (C:\Users\Joseph\Desktop\node_modules\mongodb\lib\core\topologies\server.js:438:11)
at Pool.emit (node:events:379:20)
at C:\Users\Joseph\Desktop\node_modules\mongodb\lib\core\connection\pool.js:562:14
at C:\Users\Joseph\Desktop\node_modules\mongodb\lib\core\connection\pool.js:1009:9
at callback (C:\Users\Joseph\Desktop\node_modules\mongodb\lib\core\connection\connect.js:75:5)
at C:\Users\Joseph\Desktop\node_modules\mongodb\lib\core\connection\connect.js:147:27
at C:\Users\Joseph\Desktop\node_modules\mongodb\lib\core\auth\scram.js:185:14
at _callback (C:\Users\Joseph\Desktop\node_modules\mongodb\lib\core\connection\connection.js:328:7)
at Connection.messageHandler (C:\Users\Joseph\Desktop\node_modules\mongodb\lib\core\connection\connection.js:359:9)
at Connection.emit (node:events:379:20)
at processMessage (C:\Users\Joseph\Desktop\node_modules\mongodb\lib\core\connection\connection.js:451:10)
at TLSSocket.<anonymous> (C:\Users\Joseph\Desktop\node_modules\mongodb\lib\core\connection\connection.js:620:15)
at TLSSocket.emit (node:events:379:20)
at addChunk (node:internal/streams/readable:313:12)
at readableAddChunk (node:internal/streams/readable:288:9)
at TLSSocket.Readable.push (node:internal/streams/readable:227:10)
PS C:\Users\Joseph\Desktop\server>

error er_con_count_error too many connections express mysql

I am programming in angular and create an api server in express, I have a little problem when I have been programming and making requests in the API for hours. What happens is what arrives as a maximum number of requests and throws me an error.
The operation is fine nothing fails me, it is only after a while that I get that error and for that reason the database is disconnected and my frontend in angular works.
After a while the server throws this error at me
(node:10356) UnhandledPromiseRejectionWarning: Error: ER_CON_COUNT_ERROR: Too many connections
at Handshake.Sequence._packetToError (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\protocol\sequences\Sequence.js:47:14)
at Handshake.ErrorPacket (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\protocol\sequences\Handshake.js:123:18)
at Protocol._parsePacket (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\protocol\Protocol.js:291:23)
at Parser._parsePacket (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\protocol\Parser.js:433:10)
at Parser.write (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\protocol\Parser.js:43:10)
at Protocol.write (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\protocol\Protocol.js:38:16)
at Socket.<anonymous> (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\Connection.js:88:28)
at Socket.<anonymous> (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\Connection.js:526:10)
at Socket.emit (events.js:182:13)
at addChunk (_stream_readable.js:283:12)
at readableAddChunk (_stream_readable.js:264:11)
at Socket.Readable.push (_stream_readable.js:219:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
--------------------
at Protocol._enqueue (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\protocol\Protocol.js:144:48)
at Protocol.handshake (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\protocol\Protocol.js:51:23)
at PoolConnection.connect (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\Connection.js:116:18)
at Pool.getConnection (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\Pool.js:48:16)
at Pool.query (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\Pool.js:202:8)
at Promise (C:\xampp\htdocs\sinapsisuao\server\node_modules\promise-mysql\lib\helper.js:26:45)
at Promise._execute (C:\xampp\htdocs\sinapsisuao\server\node_modules\bluebird\js\release\debuggability.js:384:9)
at Promise._resolveFromExecutor (C:\xampp\htdocs\sinapsisuao\server\node_modules\bluebird\js\release\promise.js:518:18)
at new Promise (C:\xampp\htdocs\sinapsisuao\server\node_modules\bluebird\js\release\promise.js:103:10)
at Pool.promiseCallback (C:\xampp\htdocs\sinapsisuao\server\node_modules\promise-mysql\lib\helper.js:8:16)
at pool.query (C:\xampp\htdocs\sinapsisuao\server\node_modules\promise-mysql\lib\pool.js:57:32)
at C:\xampp\htdocs\sinapsisuao\server\build\controllers\facilitadorController.js:16:42
at Generator.next (<anonymous>)
at fulfilled (C:\xampp\htdocs\sinapsisuao\server\build\controllers\facilitadorController.js:5:58)
(node:10356) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:10356) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
GET /api/facilitadores - - ms - -
OPTIONS /api/facilitadores 204 0.126 ms - 0
(node:10356) UnhandledPromiseRejectionWarning: Error: ER_CON_COUNT_ERROR: Too many connections
at Handshake.Sequence._packetToError (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\protocol\sequences\Sequence.js:47:14)
at Handshake.ErrorPacket (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\protocol\sequences\Handshake.js:123:18)
at Protocol._parsePacket (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\protocol\Protocol.js:291:23)
at Parser._parsePacket (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\protocol\Parser.js:433:10)
at Parser.write (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\protocol\Parser.js:43:10)
at Protocol.write (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\protocol\Protocol.js:38:16)
at Socket.<anonymous> (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\Connection.js:88:28)
at Socket.<anonymous> (C:\xampp\htdocs\sinapsisuao\server\node_modules\mysql\lib\Connection.js:526:10)
at Socket.emit (events.js:182:13)
at addChunk (_stream_readable.js:283:12)
at readableAddChunk (_stream_readable.js:264:11)
at Socket.Readable.push (_stream_readable.js:219:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
My code database is this:
import { createPool } from "promise-mysql";
import keys from "./keys";
export async function connect(){
const connection = createPool(keys.database);
return connection;
}
And my index is:
import express, { Application } from "express";
import morgan from 'morgan';
import cors from 'cors';
import indexRoutes from './routes/indexRoutes';
import usersRoutes from './routes/users.Routes';
import emprendedorRoutes from './routes/emprendedor.Routes';
import facilitadorRoutes from "./routes/facilitador.Routes";
import consultoriaRoutes from "./routes/consultoria.Route";
import emprendimientoRoutes from "./routes/emprendimiento.Routes";
import calendarioRoutes from "./routes/calendar.Route";
import atencionRoutes from "./routes/atencion.Route";
class Server {
public app: Application;
constructor(){
this.app = express();
this.config();
this.routes();
}
//configuracion
config(): void{
this.app.set('port', process.env.PORT || 3000);
this.app.use(morgan("dev"));
this.app.use(cors());
this.app.use(express.json());
this.app.use(express.urlencoded({extended: false}));
}
//rutas
routes(): void {
this.app.use('/',indexRoutes);
this.app.use('/api/users',usersRoutes);
this.app.use('/api/emprendedores', emprendedorRoutes);
this.app.use('/api/facilitadores', facilitadorRoutes);
this.app.use('/api/consultorias', consultoriaRoutes );
this.app.use('/api/emprendimientos', emprendimientoRoutes );
this.app.use('/api/calendar', calendarioRoutes);
this.app.use('/api/atencion', atencionRoutes)
}
//inicia servidor
start(): void{
this.app.listen(this.app.get('port'), ()=>{
console.log('Server on port', this.app.get('port'));
console.log("Conectados a la BD");
});
}
}
const server = new Server();
server.start();
Someone, who can help me with this problem, only appears when I have been programming for a while.
max_connect_errors defaults to 100. When you are using connection pools this means a number of sparatic errors can quickly add up to 64 resulting in the error experiences.
Solution part 1: remove the connection pooling. Simple per connection is ok.
Solution part 2: increase max_connect_errors to its documented maximium
Solution part 3: try to identify some of the errors that occur and see if they are programmatic mistakes or transient network connection problems.

Running test of hyperledger fabric-sdk-node

I'm trying to run test of the hyperledger fabric client node but I have some issues. Indeed, when I run the command gulp test I have lots of errors which look like this:
not ok 586 Error: SERVICE_UNAVAILABLE at ClientDuplexStream.<anonymous> (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_
modules\fabric-client\lib\Orderer.js:9:4530) at emitOne (events.js:96:13) at ClientDuplexStream.emit (events.js:188:7) at ClientDuplexStream.
_emitStatusIfDone (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\grpc\src\node\src\client.js:204:12) at ClientD
uplexStream._readsDone (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\grpc\src\node\src\client.js:169:8) at rea
dCallback (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\grpc\src\node\src\client.js:229:12)
---
operator: fail
at: Client.newDefaultKeyValueStore.then.then.then.then.then.then (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\test\int
egration\e2e\create-channel.js:211:5)
stack: |-
Error: Error: SERVICE_UNAVAILABLE
at ClientDuplexStream.<anonymous> (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\fabric-client\lib\Or
derer.js:9:4530)
at emitOne (events.js:96:13)
at ClientDuplexStream.emit (events.js:188:7)
at ClientDuplexStream._emitStatusIfDone (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\grpc\src\node\
src\client.js:204:12)
at ClientDuplexStream._readsDone (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\grpc\src\node\src\cli
ent.js:169:8)
at readCallback (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\grpc\src\node\src\client.js:229:12)
at Test.assert [as _assert] (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\tape\lib\test.js:212:54)
at Test.bound [as _assert] (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\tape\lib\test.js:64:32)
at Test.fail (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\tape\lib\test.js:277:10)
at Test.bound [as fail] (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\node_modules\tape\lib\test.js:64:32)
at Client.newDefaultKeyValueStore.then.then.then.then.then.then (C:\Users\A671975\go\src\github.com\hyperledger\fabric-sdk-node\tes
t\integration\e2e\create-channel.js:211:5)
at process._tickDomainCallback (internal/process/next_tick.js:129:7)
I think this is due to an error of connexion between the tests and the containers but I don't understand what I have to do in order to solve it. So if someone had this error before, please share the solution ;) Thanks !

DeprecationWarning: Calling an asynchronous function without callback is deprecated, where to find it?

So i keep getting this error which redirects me to node_modules and I'm not sure if I would check there.. Everything was fine until node.js version update yesterday.
The error with trace:
node --trace-deprecation tradeBot.js
(node:10062) DeprecationWarning: Calling an asynchronous function without callback is deprecated.
at maybeCallback (fs.js:95:42)
at Object.fs.writeFile (fs.js:1191:14)
at FileStorage.saveFile.FileStorage.writeFile (/****/node_modules/file-manager/index.js:68:5)
at SteamUser._handlers.(anonymous function) (/****/node_modules/steam-user/components/logon.js:252:18)
at SteamUser._handleMessage (/****/node_modules/steam-user/components/messages.js:200:29)
at emitThree (events.js:116:13)
at CMClient.emit (events.js:194:7)
at CMClient._netMsgReceived (/****/node_modules/steam-client/lib/cm_client.js:278:8)
at CMClient.handlers.(anonymous function) (/****/node_modules/steam-client/lib/cm_client.js:386:8)
at CMClient._netMsgReceived (/****/node_modules/steam-client/lib/cm_client.js:260:24)
at emitOne (events.js:96:13)
at TCPConnection.emit (events.js:188:7)
at TCPConnection._readPacket (/****/node_modules/steam-client/lib/tcp_connection.js:73:7)
at emitNone (events.js:86:13)
at TCPConnection.emit (events.js:185:7)
at emitReadable_ (_stream_readable.js:432:10)

Categories