question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'create' of undefined

See original GitHub issue
  • I’m submitting a … [x] bug report

  • Summary I just tried to use this package by copy pasting code from documentation and got error.

  • Other information

  • The stacktrace for the error is store: MongoStore.create({ mongoUrl: process.env.MONGO_URI }), ^ TypeError: Cannot read property ‘create’ of undefined at Object.<anonymous> (E:\Study\Sem. 6\Major Project\Online Food Ordering System\app.js:28:23) at Module._compile (internal/modules/cjs/loader.js:1063:30) at Object.Module._extensions…js (internal/modules/cjs/loader.js:1092:10) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) at internal/main/run_main_module.js:17:47

The code where I am getting error is - ` app.use(session({

secret: "something",
resave: false,
saveUninitialized: false,
store: MongoStore.create({ mongoUrl: process.env.MONGO_URI }), //this is line 28 where I am getting error
cookie: { maxAge: 180 * 60 * 1000, secure: true }

})); `

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
dcatanzarocommented, Mar 17, 2021

Change the

const MongoStore = require(‘connect-mongo’).default;

to

const MongoStore = require(‘connect-mongo’);

1reaction
Vaibhav-chandakcommented, Mar 18, 2021

Change the

const MongoStore = require(‘connect-mongo’).default;

to

const MongoStore = require(‘connect-mongo’);

This solved my problem, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'create' of undefined error in ...
It seems that in your user.js file you are calling a "profesor" model but in your article.js file you are exporting a "profesores"...
Read more >
Cannot Read Property of Undefined in JavaScript - Rollbar
What Causes TypeError: Cannot Read Property of Undefined. Undefined means that a variable has been declared but has not been assigned a value....
Read more >
TypeError: Cannot read property 'create' of undefined ... - GitHub
Hi, I try to follow ReferencesMany helper's method, and get this error process.nextTick(function() { throw err;}); ^ TypeError:` Cannot read ...
Read more >
STRIPE: Cannot read property 'create' of undefined
I use stripe for a payment online course project and when I use stripe in my app.js I have this result Cannot read...
Read more >
Cannot read property 'create' of undefined - Framework7 Forum
Hey, I'm relatively new to Framework7 - excuse me for asking this. Recently, I've begun development on my first app (based on the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found