Help Needed: Deploying Payload CMS Project to Vercel with MongoDB
Hi everyone,
I’ve just finished following a tutorial to build a web project using Payload CMS, and everything works fine. However, since it’s currently hosted on a paid plan with Payload, I’m looking to migrate the project to a free hosting solution with MongoDB Atlas for the database and Vercel for web hosting.
What I've done so far:
- Copied the Mongo URI from the
.envfile. - Downloaded the MongoDB Compass GUI to view my MongoDB collections.
- Connected to the database using the GUI.
- Exported the collections individually as JSON files.
- Created a new database (e.g., MongoDB Atlas or AWS) and got the new database URI.
- Imported the JSON files as new collections into the new database via the GUI.
- Recovered all my database and collections, as well as my assets.
After completing these steps, I copied the required environment variables to Vercel, and the build process succeeded. However, once deployed, the website shows that it your db is currently empty to the database
Problem:
Although the MongoDB connection seems successful, the website indicates a failure to connect once it’s live. I'm not sure where the issue lies, whether it's in the environment variables, database setup, or the connection to Vercel.
Any help would be appreciated! If anyone has experience with Payload CMS, MongoDB, or deploying to Vercel, I'd love to hear your thoughts.
Thanks in advance!