model.count(\nError in connector: Error creating a database connection. (An error occurred during DNS resolution: proto error: io error: A socket operation was attempted to an unreachable network. (os error 10051))"
here the image of error
this error comes when ever I create connection using prisma "npx prosma generate" and "npm start in my nodejs"
it works fine when ever i change my network, searched a lot some results shows there is firewall problem how can i solve this issue?
network provider asked port number on which prisma is working, how can i find that? also who to get ip address og mongodb altas.
Related
I have created a PostgreSQL with a web server DOCKER CONTAINER and my app running with an API to manage all the endpoints.
The link of my git repo is: https://github.com/JulioValderrama/store-front-project.git
But I am facing problems with the connections with the Database, as depending on the Postgres HOST name value in my .env file one of the two servers (one local running in PORT 4000 and the web server running in the docker container in PORT 3000) will work or will fail.
I have tried the next:
Local server running in PORT 4000
Docker web server running in PORT 3000
HOST "127.0.0.1"
Going to¨:
http://localhost:3000/
Works fine and get response, now when trying to connect it to any of my database API:
http://localhost:3000/products
I get the error:
"Could not get PRODUCTS. Error: Error: connect ECONNREFUSED 127.0.0.1:5432"
Going to:
http://localhost:4000
Works fine and get response, now when trying to connect it to any of my database API:
http://localhost:4000/products
It works! I get the list of all my products!!
HOST "postgres"
I put "postgres" because I read online that you have to name HOST as the postgres docker image created, which is my case. And it works for the remote server.
Going to:
http://localhost:3000
Works fine and get response, then when trying to connect it to database API:
http://localhost:3000/products
It works!! It gives me the list of my products !!
Going to:
http://localhost:4000
Works fine and get response, then when trying to connect it to database API:
http://localhost:4000/products
It gives me the error:
"Could not get PRODUCTS. Error: Error: getaddrinfo ENOTFOUND postgres"
So it seems like there is an error when trying to connect to the database due to the server or the HOST name, I have no idea....
In docker-compose.yaml you have linked your machine 5432 to containers 5432 port.
If you are using docker container and want to reach postgres, use postgres as POSTGRES_HOST value.
If you are running application outside the docker environment use 0.0.0.0, 127.0.0.1.
Make sure you haven't installed postgres locally
brew uninstall postgres
I am trying to connect to my database on heroku, which I would use on my app. I'm using either Command Line or Git Bash on windows.
I have created database on heroku named postgresql-rectangular-87454 and installed Postgres without any errors.
Typing heroku addons I'm making sure, database is set up:
$ heroku addons
Add-on Plan Price State
──────────────────────────────────────────────── ───────── ───── ───────
heroku-postgresql (postgresql-rectangular-87454) hobby-dev free created
└─ as DATABASE
but when I try to connect it via heroku pg:psql or also heroku pg:psql postgresql-rectangular-87454 --app salty-shelf-36209, I get this error:
$ heroku pg:psql
--> Connecting to postgresql-rectangular-87454
psql: could not connect to server: Connection timed out (0x0000274C/10060)
Is the server running on host "ec2-54-225-97-112.compute-1.amazonaws.com" (54.225.97.112) and accepting
TCP/IP connections on port 5432?
Any advice would be appreciated. Thank you!
Without knowing more, my first guess would be network rules -- that the connection is being blocked by a local firewall. The pg:psql command simply grabs the DATABASE_URL from your application config and passes the connection string to your local psql command to create the connection. If you're behind a corporate firewall, you may need to speak with your IT department about making an outbound connection.
I am working on a nodejs project and using mongoose module I want to connect to Mongo Atlas,
I used
mongoose.connect('mongodb+srv://<USER>:<PASSWORD>#varcv-okhmh.mongodb.net/<DATABAS_NAME>?retryWrites=true');
but I got an error:
failed to connect to server [varcv-shard-00-00-okhmh.mongodb.net:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 35.158.192.211:27017]
I also try to connect via old connection string
mongoose.connect('mongodb://peter:<PASSWORD>#varcv-shard-00-00-okhmh.mongodb.net:27017,varcv-shard-00-01-okhmh.mongodb.net:27017,varcv-shard-00-02-okhmh.mongodb.net:27017/<DATABAS_NAME>?ssl=true&replicaSet=varcv-shard-0&authSource=admin&retryWrites=true');
But I got the same error.
Notes:
everything is working perfectly on my local machine the error is happens when I upload my code to Godaddy Linux Shared hosting.
I am using PM2 to run my server.
I am using Mongo 3.6.5
I am using mongoose 5.1.5
I am a beginner to CouchDB, I need to do a school assignment with it, but now it crashed on my computer. My system is mac os, when I open the couchDB application, it keeps popping new admin windows(http://127.0.0.1:5984/_utils/#login?urlback=), but all of them are failed to connect.
When I try:
curl -X PUT http://127.0.0.1:5984
it returns
curl: (7) Failed to connect to 127.0.0.1 port 5984: Connection refused
It worked well on my computer before, seems after I tried to setup a remote node, it crashed.
What should I do to fix it?
io.adapter(redis({ host: config.redisHost, port: config.redisPort }));
Both the confif.redisHost and config.redisPort are the correct values, but when I try to connect from my code I get the error -
'Error: Redis connection to 104.xxx.xx.xxx:6379 failed - connect ECONNREFUSED 104.xxx.xx.xxx:6379'
In redis.conf I've changed the bind to 0.0.0.0 as well as removing it completely and I've also tried setting protected mode to off just to try and get the connection working.
The IP and port are definitely, correct. Does anyone know why I might not be able to access the server from my code? My code is just being ran on my local machine and the redis server is being ran on a digital ocean ubuntu 14.04 machine. The status of the server is definitely running and I can access the redis-cli from the machine itself.
For some reason, it wasn't using redis.conf when I tried starting the server, I had to manually tell it to use it when starting up, now it's working.