mongodb npm preventing application to run on www, yet runs on localhost - javascript

I have this node.js accounts app that I'm trying to implement a mongoDB database onto, but it seems to have errors when I upload it to cpanel. My mongoDB url is in this format: mongodb+srv://:#. After some experimenting, turning the Node.js version to ^14 caused errors to stop, but the app still wouldn't run (going to the url reslted in a 503 error, this is the current state of the server).
github: https://github.com/codingtuba/accounts.aimedtuba/tree/mongodb
before mongo DB: https://github.com/codingtuba/accounts.aimedtuba

Related

Network error. The request timed out in react app

my react app was working fine on localhost but
after build react app and upload it on my server it doesnt work and this is what i get
I think it doesnt connect to graphql and mongodb
and this is my dependencies
what should I do?
edit:
i changed URIs in code to my host and I dont know where's my problem
in localhost I start server every time with npm run dev is there any chance that i have start app in server too?

Deployed database has no connections

I have deployed an application to heroku: https://stark-citadel-91743.herokuapp.com/
The app initially loads properly until you click a button that requires the database. Then it crashes.
Everything works in local development environment. I believe I have properly set up all connection settings for production in heroku dashboard's config variables (database url, database name, username, password). But in production it doesn't work.
Two evidences that it's not set up right:
1) When I log into the ClearDB MySQL plugin (in my heroku dashboard) under 'current connections' it says, 'No connections are currently established to the database.'
2) When I use postman to hit a custom endpoint I made just for testing a request to the database, I get: "Error adding color: Error: connect ECONNREFUSED 127.0.0.1:3306" <-- that 127.0.0.1 seems enlightening. Why would a deployed db have a connection on that address?
Any clues? Thank you!
If your database is also set up at keroku host:
check the db setting(username, pw, port,etc.)
If you actually need to connect back to your own database(which is hosted by you or other third party);
You should find out the setting and replace with 127.0.0.1:3306, which is only work for local env
Update:
127.0.0.1 is localhost, which is your machine. Your test case is working because your server and your database are hosting on the same machine(which both have same ip). However, when your code are deployed to heroku, your heroku server cannot find a database hosted on same machine. This is why your are having this problem

Connection mysql credentials ElectronJs

I am currently using Mysql in my electron application, so I started to verify the .asar file when I compiled it, I could see that all the application code is shown, so I think the Mysql connection would be very vulnerable, there is some way to correct this?
Image:

How do I add information to my Heroku database?

I am currently trying to deploy a Node.js application to Heroku. The website is working until I try and login or do other operations that call the database. I have the database attached and keep getting the Error: write EPIPE error. From what I can tell from my research, it seems like I need a worker process. Right now I have my web process as ./bin/www and I do not know what to set my worker process to. I tried setting it to the same thing, but the app crashes. How do I add information from my app to a Heroku database?

Problems with MongoDB trying to deploy a Meteor App

I have been setting up a server on a Digital Ocean droplet in order to host a couple of Meteor apps. I'm doing everything from scratch so I can learn as much as possible. I am trying to use "Meteor-Up" (mup) to deploy an app, but it is having problem communicating with MongoDB. When I run "mup setup" I get the following error:
Started TaskList: Setup (linux)
[Gibson] - Installing Docker
[Gibson] - Installing Docker: SUCCESS
[Gibson] - Setting up Environment
[Gibson] - Setting up Environment: SUCCESS
[Gibson] - Copying MongoDB configuration
[Gibson] - Copying MongoDB configuration: SUCCESS
[Gibson] - Installing MongoDB
[Gibson] x Installing MongoDB: FAILED
-----------------------------------STDERR-----------------------------------
docker: Error response from daemon: driver failed programming external connectivity on endpoint mongodb (1e188b51b171446cd22d96f40ceab1e696019e5ac33ca713d78827246ae37ec8): Error starting userland proxy: listen tcp 127.0.0.1:27017: bind: address already in use.
-----------------------------------STDOUT-----------------------------------
latest: Pulling from library/mongo
Digest: sha256:beff97308c36f7af664a1d04eb6ed09be1d14c17427065b2ec4b0de90967bb3f
Status: Image is up to date for mongo:latest
mongodb
c17e5ac9e9369b779da4aff639c16578dedbc7c357985f67d6e7b005d9cf3939
----------------------------------------------------------------------------
But I can't get from this any indication of what's going wrong. Is the problem with Mongo, Meteor, mup, or docker?
EDIT:
So far I understand from the message that "mup" is trying to connect to Mongo on port 27017 and is failing, I just don't understand why or how to fix it. I have a database that I want the app to connect to, which I moved onto the server from my local machine using mongodump and mongorestore. The thing I can't solve is how to connect my meteor app to that mongo DB.
It does not just try to connect to mongod, but it installs mongod in a container and tries to bind port 27017 to local interface.
If you already have mongodb installed and prefer to use it instead, you need to disable installation of mongodb in mup.js, mup.json, or whatever configuration file is being used in your version of mup.

Categories

Resources