cannot read properties of undefined (reading'errors') - node.js

enter image description here
I'm new to full-stack development.
I'm running my application on localhost, node.js for backend, react js for front-end, and MongoDB
everything is connected to the localhost when I try to login from the admin dashboard this error is shown any help

the error.networkError.result value is undefined, so there is no there is no undefined.errors try console.log(error.networkError) and go through the keys maybe also console.log(Object.keys(error.networkError))

Related

How to configure node js application for deployement with mongo DB and vercel?

I finished an application with JS, Mongo Db Atlas, and node Js(express). It works fine locally on my computer.
I am trying to put it online with vercel. I have linked my vercel account to Github. The front end part of my application works fine but every request to the backend don't work...
This is the error message that i get :
Failed to load resource: net::ERR_CONNECTION_REFUSED.
Is there somethin that i am supposed modify in my code when I put it online ?
My request still look like this :
const fetchCardList = () => {
fetch("http://localhost:5000/api/card/")
.then((reponse) => reponse.json())
.then((allSpikemmon) => {.................
Am i supposed to replace localhost:5000 by something ?
Thanks a lot !

Error on My heroku app when adding new user to MongoDB

so I have a controller on my app to add new officers like this
when I develop it on my localhost server it worked just fine however when I deploy it on heroku then try it again I received this error
I'm new on heroku and I honestly can't find out how to fix this can someone help me?
I'm using mongoose and mongoDB atlas btw
The data however successfully got inserted even tho the app got the error

Can't authenticate to local MongoDB database

I recently started working on a project with Express and since I'm using Node.js as backend I chose MongoDB as my database. It's my first time working with Mongo but I can't authenticate with Express, it works fine from terminal. I followed the guide from MogoDB blog here. I tried using their Atlas service where I had no problem authenticating. I'm using MongoDB driver. Here's how my connection URI looks like:
const uri = `mongodb://${username}:${password}#127.0.0.1/cloud?retryWrites=true&w=majority`;
I tried changing mongodb:// to mongodb+srv:// but that resulted in invalid connection string error.
You need to specify the authentication database, usually admin:
const uri = `mongodb://${username}:${password}#127.0.0.1/cloud?authSource=admin&retryWrites=true&w=majority`;
If you don't specify it then in your case MonogDB defaults the authentication database to cloud - which is most likely wrong.
When you are accessing mongodb on the web you can click on connect and on connect your application. You will show the uri to copy paste starting with
mongodb+srv://USERNAME:PASSWORD#CLUSTER/DATABASE
You forgot to specify the CLUSTER. Currently is your local Database

Host for Mongo db atlas: only work locally not on Heroku

I am newbie in programming restful api with nodejs and mongo db atlas.
I finished all the videos in this list https://www.youtube.com/watch?v=ucuNgSOFDZ0&index=14&list=PL55RiY5tL51q4D-B63KBnygU6opNPFk_q
I can run my code successful locally at localhost:3000 but when I deploy it on heroku, It crashes then I try with "heroku logs" and it shows that:
You can find the whole project at: https://github.com/academind/node-restful-api-tutorial/tree/13-controllers (just neet to change the password field for mongo atlas in the nodemon.json)
Please help. Thank you for your reading.

Deploying Node.js, React.js, Express, and Socket.io Application on Heroku

enter image description hereSuccessfully deployed to Heroku and most of our application is working. However, our socket.io pieces (chat, view online users, game updates) are not functioning. We think this may be due to having an instance of socket initialized in the Board.js component and also in the App.js file but not sure if that is the issue or how to resolve.
GitHub: https://github.com/sranney/checkers
Heroku App: https://afternoon-thicket-28146.herokuapp.com/
Any help is greatly appreciated Photo1 1: Server Config for Http Server Photo 2: Shows Proxy Photo 3: Configuring socket in app component Photo 4: Importing socket into app
It looks like you are missing an io.connect statement in your server.js file. Check out this video (https://www.youtube.com/watch?v=y5tRiFJuNOs) along with the source code in the description.

Resources