Local writes to MongoDB Atlas, but not deployments

Hey guys how are you?

Seeking some help.

Made a basic function to write to MongoDB atlas… it works perfectly on my local machine.

However, once deployed, it does not write to the DB anymore.
No errors or anything.

I have made sure:

  • The connection string is correct
  • Network access ( from anywhere ) is provided in atlas
  • The user has all the rights

Like i said, local works, not deployment… no errors given either.
Any idea what i might be doing wrong?

Hi @moodevarts, welcome to the Vercel Community!

Thanks for sharing these details but it’s really hard to debug the issue without looking at the actual code. Can you please share your public repo or a minimal reproducible example. That will let us all work together from the same code to figure out what’s going wrong.

Hi @anshumanb,

Thanks for your reply.
I could debug the issue… the way I ran the hardcoded function, it ran only the 1st time when deployed… after that it serves the cached web page and hence doesn’t actually load the page again on the server.

This had me believing the deployment does not write… whereas it just didnt run the function the way i was expecting.

Learned something very valuable!

Thank you and best regards,
Hima.

1 Like

That’s great. Thanks for sharing your solution here!

Looking forward to see you more around here.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.