Prashant0664/Blog-website

Uncaught runtime error, how to fix this?

Closed this issue · 3 comments

Screenshot 2024-05-02 211415
Screenshot 2024-05-02 211436

This screenshots is of :after going live , which shows uncaught runtime error.

Screenshot 2024-05-02 211548
this one is of terminal where on backend side ,it shows : [nodemon] app crashed & on client side it works perfectly.

**So, How to solve these errors if you could help it would be great. As I'm a beginner , I don't know how to fix this.. Sorry for disturbance. **
@Prashant0664 kindly reply.

Hii @KhushiViper02 ,
Have you setup the .env file correctly in backend?
It includes:
MONGO_URI
GOOGLE_CLIENT
GOOGLE_SECRET
COOKIE_KEY
TOKEN_SECRET
CLOUD_NAME
CLOUD_API_KEY
CLOUD_API_SECRET
PASS
REACT_APP_BACKEND_URL

MONGO_URI=[mongo_db_uri]
GOOGLE_CLIENT=[google client id generated from google console]
GOOGLE_SECRET=[google client id secret(of the same project as client)]
COOKIE_KEY=[any hashed string from https://jwtsecret.com/generate ]
TOKEN_SECRET=[any secret like 30days]
CLOUD_NAME=[cloud name of cloudinary]
CLOUD_API_KEY=[cloud api key of cloudinary]
CLOUD_API_SECRET=[cloud secret of cloudinary]
PASS=[your google app password generated after turning on 2 step verification]
REACT_APP_BACKEND_URL=[http://localhost:5000 if used in local machine, otherwise hosted website url (don't put / after url, eg: www.google.com/ is wrong and www.google.com is correct]

You can watch any recent YouTube video to get these keys and ids because it will be too difficult to explain here.

in frontend .env , add

REACT_APP_BACKEND_URL="http://localhost:5000" or url of backend.

To check if backend is connected properly, check console in browser.

[Content may load slowly (~in 2-3 mins) initially because it stores all data in local storage from database]