Trying to open unclosed mongoose

Hello every one i am testing my code at circleCi of Mean stack application. It is throwing error on mongoose connection " Error: Trying to open unclosed connection. "
function connect() {
mongoose.Promise = global.Promise;
return mongoose.connect(config.mongodb.url, {
server: {
socketOptions: {
keepAlive: 1,

this is my function on server.js and it shows error on the start of function connect()… kindly guide me why this error is occuring and how will it solve…