MongooseServerSelectionError: connect ETIMEDOUT 13.250.154.115:27017 - javascript

While I'm working on my school project, This error just randomly showed up.
Error connecting to MongoDB: MongooseServerSelectionError: connect ETIMEDOUT 13.250.154.115:27017
even in the compass is not working, I tried to run my other project that has a MongoDB connection and they are all inputting the same error
I tried to search it before asking this. this is what I already did
-terminating cluster and creating new
-check the IP address in network access and it's in public
-restart my laptop
-creating a new MongoDB account
-doubled check the URI
enter image description here
enter image description here
is there having the same problem as me that is being solved?
btw I'm using mern stack

try this :
mongoose.connect(process.env.MONGO_URI,{ useNewUrlParser: true, useUnifiedTopology: true });
In order to better understand these options, I strongly recommend you to read the Mongoose documentation about the deprecation warnings.
https://mongoosejs.com/docs/5.x/docs/deprecations.html

Related

psql database setup and connection on fedora linux

I've recently started work on a project that requires a psql database. I've followed numerous guides on setting up psql database on fedora, and have got my db up and running. I am able to connect into it using sudo -u postgres psql the project I am working on has a init-db bash scrip that is used to set up all the relation and tables for the database, which I am able to query once I am in the psql view on my terminal.
My issue is that no other application or software is able to connect to the database. At first I though it was a issue with the code left by previous developers but with further investigation I am unable to connect to it even using Jetbrain 'Database Tools and SQL' plug in.
I Have Tried a few thing to fix this (listed bellow) but none have worked
edited the postgresql.conf file to contain linsten_addresses = '*'
editted the pg_hba.conf file to have host all all 0.0.0.0/0
tried connecting to the database via JetBrains 'Database Tools and SQL' using localhost, my public ip, and my private ip
( yes I am sure i have to correct login details )
None of the above worked. I have tinkered with this for 4 hours now and have not gotten it to connect, so any suggestions would be much appreciated. If there is anything that i have missed out please ask and I will update the post with the needed information

MongoDB and Heroku Deployment

Alright stuck here. This app - https://budget-vacation-offline.herokuapp.com/ .
I have added my environment variables to Heroku as well. There is an error in the console too regarding the mongo network. What am I missing? Happy to link the repository if needed. This is my error locally.
App running on port 7894!
(node:1177) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [localhost:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017
The error mean that your app need to connect to an instance of mongodb, which not available on the address you set(localhost). So to fix the error you need to provide the correct url to connect.
To get a mongodb instance you can host your own mongodb server or use online mongodb service such as mongodb official service Atlas.
Previously, there is exist an add-on for mongodb mLab on heroku that you can use but it seem that it's has been discontinued.

Sails js, error when connect to cloud mongodb

I used cloud MongoDB in sails adapter but when I am running app, it throw an error, can someone help how to solve it?
default: {
adapter: 'sails-mongo',
url: 'mongodb://USERNAME:PASS#cluster0-shard-00-00.ikncs.mongodb.net:27017,cluster0-shard-00-01.ikncs.mongodb.net:27017,cluster0-shard-00-02.ikncs.mongodb.net:27017/test?ssl=true&replicaSet=atlas-qhs0wy-shard-0&authSource=admin&retryWrites=true&w=majority'
}
error: Error: Consistency violation: Unexpected error creating db connection manager:
MongoError: connection 3 to cluster0-shard-00-01.ikncs.mongodb.net:27017 closed
error: Could not tear down the ORM hook. Error details: Error: Consistency violation: Attempting to tear down a datastore (default) which is not currently registered with this adapter. This is usually due to a race condition in userland code (e.g. attempting to tear down the same ORM instance more than once), or it could be due to a bug in this adapter. (If you get stumped, reach out at http://sailsjs.com/support.)
This looks like you are unable to connect to the cluster hosted on Atlas.
You will need to add your IP to the whitelist on Atlas. In the security section, under Network Access, add your IP to the whitelist (or the IP of the server you're connecting to the cluster from if you are using a remote server).

Node.JS MySql Module - Cannot Connect to Any Database - ECONNRESET

I'm trying to use the mysql module to connect to my database. But everytime, I get the following error: read eCONNRESET There is problem. (Note, that last part is from my console log. See below.)
I don't think this is a problem with database security settings. I've been trying to connect to my new database (hosted on AWS) for the last several days with no luck. Then, just now I attempted to connect to an Azure database that has been running smoothly for a couple years. Same problem: read eCONNRESET.
By the way, if I randomly change the host string to something invalid, my code returns an error saying the host wasn't found. So that tells me it's working to some extent.
I'm very new to the coding world and need all the help I can get.
Here's my code:
console.log('starting Launch');
var mysql = require('mysql');
var connection = mysql.createConnection({
host : '....windows.net',
user : 'test',
password : 'test',
port : '1433'
})
console.log('step2')
connection.connect(function (err) {
if (!err)
console.log("conncetd");
else
console.log(err + "There is problem");
});
Copy full error message.
Check connectivity to your DB instance, use nmap (linux) or telnet (windows). If you can't reach host - check your local machine and server firewall, restrictions. If you can, go to 2.
Try to use different MySQL client, MySQL WorkBench, HeidiSQL, DBeaver.
If you can't - than something wrong with MySQL configuration. If you can, go to 3.
Copy info about: OS, node version, mysql module version.
you could try
mysql.createPool({});
instead of
mysql.createConnection({})

adonisjs migration issue with mysql

I'm trying to get the hang of adonisjs through this tutorial
I set up everything properly as instructed in there but I run into a problem when I type adonis migration:run.
The error I get on Terminal is Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'#'localhost' (using password: NO)
I have 0 experience with mysql and this confuses me. I'd appreciate some guidance/help here.
Cheers!
#katotopark, this means your MySQL server is rejecting the connection from the Adonisjs application. check for a file called (.env) in the root folder of your project and inside you will need to add the credentials for the connection the MySQL server. (probably user: root, password: the password you use when you installed MySQL)
your .env should look similar to this.
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=root/or-another-mysql-user
DB_PASSWORD=your-database-user-password***
DB_DATABASE=the_name_of_your_database
Regards.

Categories

Resources