MongoDB socket.io deployment issue

I’ve developed a MERN stack app and I’m currently in the process of deploying it. Unfortunately, I’m facing issues with connecting to the database. While testing locally, I created a new user, and it worked well, the new users appeared in MongoDB Compass. However, when I create a new user on the deployed website, these changes don’t seem to reflect in the production environment.

To give some context, I’ve deployed the backend as a web service and the frontend using React as a static website. Despite checking both the browser console for frontend errors and the Render logs, I haven’t been able to identify any specific issues related to the deployment. I’m fairly new to this process, and I’ve spent a considerable amount of time searching for solutions related to Render deployment, but unfortunately, I haven’t come across anything that resolves my particular problem.

For reference, you can access the website here:
Website
, and the repository is available on GitHub: Repo. I apologize if there’s any confusion in my explanation and appreciate any help.

Hey Robert. I’m unfamiliar with frontend technologies, but when I looked at the console logs after clicking the “Submit” button on the Register page, the FormData object that gets passed into the Axios POST request looked empty (see below). So, this may not be an issue related to Render.

P.S. This looked like a fun app to build! I’d love to give it a spin after the registration flow issue is resolved haha.

1 Like

Thanks for your help.I managed to fix the authentication issue.
Yeah it was a really fun project to do :smiley: I’m glad you are showing interest in trying it.
Thinking of adding more features in the future and fixing some other stuff
Currently I am getting multiple socket.io errors in the /chat route and I am not entirely sure if the way I set up socket.io is correct
I’ve tried finding some solutions but to no avail
Failed to load resource: net::ERR_CONNECTION_REFUSED

I was able to log in (as test1234); very cool app!! I need to learn about sockets haha. I probably won’t be able to help debug, but this article helped me when I got stuck in the past: What is Debugging? How to Debug Your Code for Beginners. Hope this helps. Have fun!

Thanks for the tips and the motivation. :wink:
I think I finally managed to fix the online/offline status and the direct messages.I am learning about socketio and MERN stack in general from Llamadev on Youtube.
I changed the socketio instance url to point to my backend service and also changed from port 5000 to port 4000 (not sure if it has any effect,just seen in stackoverflow it might work) :

useEffect(() => {
   setSocket(io("https://nexotalk.onrender.com"));
   let getCurrentUserId = async() => {
   let sender = await axios.get('https://nexotalk.onrender.com/api/user/get-current-user', config);
   setCurrentUserId(sender?.data.currentUser._id);
   }
   getCurrentUserId()
  
 }, []);

No more socketio errors for the time being,only some cloudinary warning I will take care of later.
image

1 Like