Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'on' of undefined in server.js file #338

Closed
lumos102 opened this issue Jan 10, 2019 · 2 comments
Closed

Comments

@lumos102
Copy link

when I run npm start after cp .env.example .env, it shows: TypeError: Cannot read property 'on' of undefined in server.js file(line 43)

@sanchit94
Copy link

Ran into the same error. I guess mongoose API has changed, so the connection property is now in the mongoose object. Essentially, this is how the connect() function in server.js should look like now

function connect () {
  var options = { server: { socketOptions: { keepAlive: 1 } } };
  mongoose.connect(config.db, options);
  return mongoose.connection;
}

@madhums
Copy link
Owner

madhums commented Mar 11, 2019

Hi, sorry for the late response. This should be fixed now. Also note that keepAlive is not nested anymore. 642fba2#diff-78c12f5adc1848d13b1c6f07055d996e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants