Issue with Backend Functionality (Creating, Editing, Deleting Posts) after Deployment on Netlify

Hello fellow developers,

I recently deployed my MERN website on Netlify, and I’m encountering an issue with the backend functionality. On my local machine, everything works perfectly fine, including registration, login, and CRUD operations (creating, editing, and deleting posts). However, after uploading the website to Netlify, I noticed that only the registration and login functionality is working properly. When it comes to creating, editing, or deleting posts, it fails to work as expected. The website is currently accessible at the following URL: website URL.

you can create an account to test it.

Frontend GitHub Repository: GitHub - Frontend
Backend GitHub Repository: GitHub - Backend
are the details and links related to my project:

After some investigation, I suspect that the problem lies with the JWT token. It seems that the token is not functioning correctly once the website is deployed on Netlify. I have reviewed my code and ensured that the necessary authentication steps are in place, but the issue persists.

I would appreciate any insights, suggestions, or potential solutions to help resolve this problem. It’s important for the CRUD operations on my website to function consistently, both locally and after deployment.

Thank you in advance for your time and assistance. Let me know if any additional information or code snippets are needed to further diagnose the issue.

What I have done so far, I tried to make a proxy , added some option on cors, and also redirect on netlify but nothing works.

To provide additional context, here are some key points about my setup:

Backend: The backend is built using Express.js and Node.js, with MongoDB as the database.
Frontend: The frontend is deployed on Netlify, and I have confirmed that it loads successfully on my local machine.
Deployment Environment: The backend is deployed on a separate server.

Your authentication mechanism is using cookies: blog_api/index.js at main · jondereck/blog_api (

As far as I can check, there’s no token cookie being sent with the /post request at least:

I see you’re trying to set a cookie, but that’s being rejected by the browsers do the the mentioned error.

Thank you It is already working, In the'/login') and'/logout') routes, the res.cookie method now includes additional options: sameSite: 'none' , secure: true , and httpOnly: true . These options ensure that the cookie is set correctly for cross-site usage and is secure.

Appreciate the reply.

1 Like

Glad to hear it’s working now. Thanks for coming back and sharing your solution with the community.

1 Like