Create and Save a Model Challenge (MongoDB and Mongoose)

Tell us what’s happening:
Trying to pass this MongoDB and Mongoose challenge and server keeps timing out. Not sure what I’m doing wrong… Getting the following errors in the glitch logs.

(node:5190) UnhandledPromiseRejectionWarning: MongoTimeoutError: Server selection timed out after 30000 ms

at Timeout.setTimeout [as _onTimeout] (/rbd/pnpm-volume/504c17cc-59c0-4329-8a3d-1a3080628a16/node_modules/.registry.npmjs.org/mongodb/3.3.5/node_modules/mongodb/lib/core/sdam/server_selection.js:308:9)

at ontimeout (timers.js:436:11)

at tryOnTimeout (timers.js:300:5)

at listOnTimeout (timers.js:263:5)

at Timer.processTimers (timers.js:223:10)

(node:5190) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

(node:5190) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Your code so far
My package.json…

  "name": "fcc-mongo-mongoose-challenges",
  "version": "0.0.1",
  "description": "A boilerplate project",
  "main": "server.js",
  "scripts": {
    "start": "node server.js"
  },
  "dependencies": {
    "mongoose": "^5.8.1",
    "mongodb": "^3.4.0",
    "express": "^4.17.1",
    "body-parser": "^1.19.0"
  },
  "engines": {
    "node": "4.4.5"
  },
  "repository": {
    "type": "git",
    "url": "https://hyperdev.com/#!/project/welcome-project"
  },
  "keywords": [
    "node",
    "hyperdev",
    "express"
  ],
  "license": "MIT"
}

myApp.js file …

const mongoose = require('mongoose')
mongoose.set('useNewUrlParser', true);
mongoose.set('useUnifiedTopology', true);
mongoose.connect(process.env.MONGO_URI);
console.log('DB connected...');
var personSchema = new mongoose.Schema({
  name: {type: String, required: true},
  age: Number,
  favoriteFoods: [String]
});

var Person = mongoose.model('Person', personSchema);

var createAndSavePerson = function(done) {
  var bigs = new Person({
    name: 'Biggy',
    age: 18,
    favoriteFoods: ['jerky', 'apples']
  });
  bigs.save((err, data) => {
    if (err)
      return done(err);
     return done(null, data);
   });
  };

my URI from .env (username and password retracted)

GLITCH_DEBUGGER=true
MONGO_URI='mongodb+srv://AKSDF:AKSDF@dgcluster-xgrh1.mongodb.net/test?retryWrites=true&w=majority'

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36.

Challenge: undefined

Link to Glitch project:

Link to the challenge:
https://www.freecodecamp.org/learn/apis-and-microservices/mongodb-and-mongoose/create-and-save-a-record-of-a-model

Link to the Glitch Project:

Here i Have All possible Solution For This Error icetutor.com