Encountering an error during deployment on Vercel or Netlify. The same error persists on both platforms. Any suggestions on resolving this issue would be greatly appreciated.
Snippet of the Database code:
import mongoose from 'mongoose';
const connection = {};
async function connect() {
// Implementation details omitted for brevity
}
async function disconnect() {
// Implementation details omitted for brevity
}
function convertDocToObj(doc) {
// Implementation details omitted for brevity
}
const db = { connect, disconnect, convertDocToObj };
export default db;
Error Screenshot
https://i.sstatic.net/3MqBG.png
Error:
(
uri{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"MongooseError: The
parameter to
openUri()mongoose.connect()must be a string, got \"undefined\". Make sure the first parameter to
or
mongoose.createConnection()uriis a string.","trace":["Runtime.UnhandledPromiseRejection: MongooseError: The
parameter to
openUri()mongoose.connect()must be a string, got \"undefined\". Make sure the first parameter to
or
mongoose.createConnection())is a string."," at process.<anonymous> (/var/runtime/index.js:35:15)"," at process.emit (events.js:314:20)"," at processPromiseRejections (internal/process/promises.js:209:33)"," at processTicksAndRejections (internal/process/task_queues.js:98:32)"]}