Hi there, I am trying to use glitch for the first time and keep running into issues and I am out of ideas. The websites keeps timing out after 10 seconds.
Logs:
MongooseError: The `uri` parameter to `openUri()` must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string.
at NativeConnection.createClient (/rbd/pnpm-volume/7c3c2d0f-0b1e-4db6-aad4-d27c281813e5/node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js:206:11)
at NativeConnection.openUri (/rbd/pnpm-volume/7c3c2d0f-0b1e-4db6-aad4-d27c281813e5/node_modules/mongoose/lib/connection.js:801:34)
at Mongoose.connect (/rbd/pnpm-volume/7c3c2d0f-0b1e-4db6-aad4-d27c281813e5/node_modules/mongoose/lib/mongoose.js:404:15)
Jump Toat main (/app/app.js:44:18)
Jump Toat Object.<anonymous> (/app/app.js:42:1)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
This is my connection:
const mongoDB = process.env.MONGODB_URI;
main().catch((err) => console.log(err));
async function main() {
await mongoose.connect(mongoDB);
I also get this error:
ValidationError: The 'X-Forwarded-For' header is set but the Express 'trust proxy' setting is false (default). This could indicate a misconfiguration which would prevent express-rate-limit from accurately identifying users. See https://express-rate-limit.github.io/ERR_ERL_UNEXPECTED_X_FORWARDED_FOR/ for more information.
at Object.xForwardedForHeader (/rbd/pnpm-volume/7c3c2d0f-0b1e-4db6-aad4-d27c281813e5/node_modules/express-rate-limit/dist/index.cjs:166:13)
at Object.wrappedValidations.<computed> [as xForwardedForHeader] (/rbd/pnpm-volume/7c3c2d0f-0b1e-4db6-aad4-d27c281813e5/node_modules/express-rate-limit/dist/index.cjs:338:22)
at Object.keyGenerator (/rbd/pnpm-volume/7c3c2d0f-0b1e-4db6-aad4-d27c281813e5/node_modules/express-rate-limit/dist/index.cjs:593:20)
at /rbd/pnpm-volume/7c3c2d0f-0b1e-4db6-aad4-d27c281813e5/node_modules/express-rate-limit/dist/index.cjs:644:32
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async /rbd/pnpm-volume/7c3c2d0f-0b1e-4db6-aad4-d27c281813e5/node_modules/express-rate-limit/dist/index.cjs:625:5 {
code: 'ERR_ERL_UNEXPECTED_X_FORWARDED_FOR',
help: 'https://express-rate-limit.github.io/ERR_ERL_UNEXPECTED_X_FORWARDED_FOR/'
If I set trust proxy to true, it comes with another error saying that anyone can bypass it.
Any help appreciated!