error er_con_count_error too many connections express mysql - javascript

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.

Related

Why nodejs is not allowing me to access other route when I access the root route?

I am using the HTTP module of nodejs to create three routes('/','/about' and the last one treats any other route that is not defined as error route). When I access the root route first and try to access other route nodejs throw an error but when I access the error route or the about the route and try accessing another route it works fine.
Below are the code I wrote and the error nodejs throw
Error
PS C:\Users\Maxwell\Desktop\node> node app.js
node:events:368
^
Error [ERR_STREAM_WRITE_AFTER_END]: write after end
at new NodeError (node:internal/errors:371:5)
at ServerResponse.end (node:_http_outgoing:846:15)
at Server.<anonymous> (C:\Users\Maxwell\Desktop\node\app.js:10:9)
at Server.emit (node:events:390:28)
at parserOnIncoming (node:_http_server:951:12)
at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
Emitted 'error' event on ServerResponse instance at:
at emitErrorNt (node:_http_outgoing:726:9)
at processTicksAndRejections (node:internal/process/task_queues:84:21) {
code: 'ERR_STREAM_WRITE_AFTER_END'
}
PS C:\Users\Maxwell\Desktop\node> node app.js
node:events:368
throw er; // Unhandled 'error' event
^
Error [ERR_STREAM_WRITE_AFTER_END]: write after end
at new NodeError (node:internal/errors:371:5)
at ServerResponse.end (node:_http_outgoing:846:15)
at Server.<anonymous> (C:\Users\Maxwell\Desktop\node\app.js:10:9)
at Server.emit (node:events:390:28)
at parserOnIncoming (node:_http_server:951:12)
at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
Emitted 'error' event on ServerResponse instance at:
at emitErrorNt (node:_http_outgoing:726:9)
at processTicksAndRejections (node:internal/process/task_queues:84:21) {
code: 'ERR_STREAM_WRITE_AFTER_END'
}
Code
const http = require('http');
const server = http.createServer((req,res)=>{
if(req.url==='/'){
res.end('Welcome Home Dev, You are loved');
}
if(req.url==='/about'){
res.end('This is the about page')
}
res.end(
`<h1>OOOp</h1>
<p>It seen like this page does not exit</p>
<a href='/'>back to homepage</a>
`
);
});
server.listen(5000);
Change to an if/else so you're only processing one branch of the if per request:
const server = http.createServer((req,res)=>{
if(req.url === '/'){
res.end('Welcome Home Dev, You are loved');
} else if (req.url === '/about') {
res.end('This is the about page')
} else {
res.end(
`<h1>OOOp</h1>
<p>It seen like this page does not exit</p>
<a href='/'>back to homepage</a>`);
}
});
Or, alternately, you could add a return after each res.send() to stop further execution in your request handler after you send a response. Remember, that just because you call res.send() your function still continues to execute so you need to manage control flow so the other code that sends a response doesn't execute once you've already sent a response.

got packets out of order. Expected 3 but received 0

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

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 trying to do search for records matching criteria with MongoDB

I am taking a training course, on Udemy, and it had backend code already written, as the course is purely about frontend development. It uses a very simple MongoDB database that I created. I determined that MongoDB version 4.0.10 is installed on my computer, in case that's relevant. When trying to perform a query for matching records, I get the following error:
UnhandledPromiseRejectionWarning: MongoError: FieldPath field names may not start with '$'.
at MessageStream.messageHandler (I:\DEV\Training\React For the Rest of Us\backend-api\node_modules\mongodb\lib\cmap\connection.js:268:20)
at MessageStream.emit (events.js:315:20)
at processIncomingData (I:\DEV\Training\React For the Rest of Us\backend-api\node_modules\mongodb\lib\cmap\message_stream.js:144:12)
at MessageStream._write (I:\DEV\Training\React For the Rest of Us\backend-api\node_modules\mongodb\lib\cmap\message_stream.js:42:5)
at writeOrBuffer (internal/streams/writable.js:358:12)
at MessageStream.Writable.write (internal/streams/writable.js:303:10)
at TLSSocket.ondata (internal/streams/readable.js:719:22)
at TLSSocket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
(node:51960) 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(). To
terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
After looking into the backend code, I found the following code that is being used to perform the query/search, and I did notice that there are $ symbols in various places.
Post.search = function(searchTerm) {
return new Promise(async (resolve, reject) => {
if (typeof(searchTerm) == "string") {
let posts = await Post.reusablePostQuery([
{$match: {$text: {$search: searchTerm}}},
{$sort: {score: {$meta: "textScore"}}}
])
resolve(posts)
} else {
reject()
}
})
}
What exactly is wrong and how do I fix it?
Identical error here. Searching from react using axios in the main app-very simple(supposed to be). It's indicative that in my case when trying to search- "open search mode" from react", mongodb server crashes with mentioned error:
f:\PrgsReact\SimplePost\backend-api\node_modules\mongodb\lib\cmap\connection.js:268
callback(new MongoError(document));
MongoError: FieldPath field names may not start with '$'.
etc..
I'm tried to change npm ver of mongodb and axios inter alia. Thanks.

Cannot connect to MySQL database with Node.js

My app has to connect to a mysql database but i am stuck just in that moment i cant connect it, im using a method that transforms callbacks code to promise code thats the reason i need to use async and await also the man of the tutorial doesnt have any error i guess because he has diferent terms on the keys.js, he is on linux, root user and also he has a password, things that i dont have. I really need hel thank you.
This is the code that is giving problems:
const express= require('express');
const router= express.Router();
const pool = require('../database');
router.get('/add', (req,res) =>{
res.render('casas/add');
});
router.post('/add', async (req,res) => {
const {titulo, precio, direccion, numhab, superficie} = req.body;
const nuevoPiso={
titulo,
precio,
direccion,
numhab,
superficie
};
await pool.query('INSERT INTO PISOS set ?', [nuevoPiso]);
res.send('recibido');
});
module.exports=router;
The problem is on the await line because if I delete that and the async word it works perfectly but obviously without that I cant send the elements to the database. The error that gives me the terminal is this:
(node:9548) UnhandledPromiseRejectionWarning: Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'Axell'#'localhost' (using password: NO)
at Handshake.Sequence._packetToError (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\protocol\sequences\Sequence.js:47:14)
at Handshake.ErrorPacket (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\protocol\sequences\Handshake.js:123:18)
at Protocol._parsePacket (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\protocol\Protocol.js:291:23)
at Parser._parsePacket (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\protocol\Parser.js:433:10)
at Parser.write (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\protocol\Parser.js:43:10)
at Protocol.write (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\protocol\Protocol.js:38:16)
at Socket.<anonymous> (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\Connection.js:88:28)
at Socket.<anonymous> (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\Connection.js:526:10)
at Socket.emit (events.js:311:20)
at addChunk (_stream_readable.js:294:12)
--------------------
at Protocol._enqueue (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\protocol\Protocol.js:144:48)
at Protocol.handshake (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\protocol\Protocol.js:51:23)
at PoolConnection.connect (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\Connection.js:116:18)
at Pool.getConnection (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\Pool.js:48:16)
at Pool.query (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\Pool.js:202:8)
at internal/util.js:297:30
at new Promise (<anonymous>)
at Pool.query (internal/util.js:296:12)
at C:\Users\Axell\Desktop\node-sql-app\src\routes\casas.js:20:15
at Layer.handle [as handle_request] (C:\Users\Axell\Desktop\node-sql-app\node_modules\express\lib\router\layer.js:95:5)
(node:9548) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:9548) [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.
POST /casas/add - - ms - -
(node:9548) UnhandledPromiseRejectionWarning: Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'Axell'#'localhost' (using password: NO)
at Handshake.Sequence._packetToError (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\protocol\sequences\Sequence.js:47:14)
at Handshake.ErrorPacket (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\protocol\sequences\Handshake.js:123:18)
at Protocol._parsePacket (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\protocol\Protocol.js:291:23)
at Parser._parsePacket (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\protocol\Parser.js:433:10)
at Parser.write (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\protocol\Parser.js:43:10)
at Protocol.write (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\protocol\Protocol.js:38:16)
at Socket.<anonymous> (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\Connection.js:88:28)
at Socket.<anonymous> (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\Connection.js:526:10)
at Socket.emit (events.js:311:20)
at addChunk (_stream_readable.js:294:12)
--------------------
at Protocol._enqueue (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\protocol\Protocol.js:144:48)
at Protocol.handshake (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\protocol\Protocol.js:51:23)
at PoolConnection.connect (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\Connection.js:116:18)
at Pool.getConnection (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\Pool.js:48:16)
at Pool.query (C:\Users\Axell\Desktop\node-sql-app\node_modules\mysql\lib\Pool.js:202:8)
at internal/util.js:297:30
at new Promise (<anonymous>)
at Pool.query (internal/util.js:296:12)
at C:\Users\Axell\Desktop\node-sql-app\src\routes\casas.js:20:15
at Layer.handle [as handle_request] (C:\Users\Axell\Desktop\node-sql-app\node_modules\express\lib\router\layer.js:95:5)
(node:9548) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
POST /casas/add - - ms - -
I dont know where the error is maybe on my keys.js where i have this im on windows that is my username but I dont have a password:
module.exports={
database:{
host:'localhost',
user:'Axell',
database: 'casas',
password: ''
}
};
Here you can download the whole app it is unfinished because I cant continue due to this error: https://mega.nz/#!LAwgwAQK!OiuBqH4qxyT5CW2xRSUXdmhpfRyTtf3TobmYw-NqIic
Thank you so much!
The issue you are having is unrelated to async/await.
The credentials to MySQL incorrect. This could be an incorrect username, an incorrect password or perhaps you did not grant the Axell permission to access the casas database.
Given that you're on localhost, you can test this without localhost. Just try logging on with the same credentials with some other mysql tool (such as the mysql) tool, and you should get a similar error.

Categories