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.

Ever Since Upgrade: TypeError: Cannot read property 'Store' of undefined

See original GitHub issue

I upgraded connect-mongo today and my application keeps crashing due to the following error. Can anyone contribute any advice on this issue?:

/Desktop/node/application/node_modules/connect-mongo/lib/connect-mongo.js:30
  var Store = connect.session.Store;
                             ^
TypeError: Cannot read property 'Store' of undefined
//express/mongo session storage
        app.use(express.session({
            secret: '90s8fa0s8fa',
            store: new mongoStore({
                url: config.db,
                collection: 'sessions'
            })
        }));

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:11

github_iconTop GitHub Comments

16reactions
rknellcommented, Mar 12, 2015

For any other suckers out there who are banging their head against this, also remember that you need to add session after you require connect-mongo:

var session = require('express-session');
var MongoStore = require('connect-mongo')(session);

This will cause the same error!

1reaction
jerevick83commented, Apr 2, 2021

I advice you upgrade your package.json dependencies install connect-mongo then in your terminal, cd to your project root directory and enter the following:

npm install -g npm-check-updates

ncu -u

npm updates

npm install

then follow the steps in the ‘connect-mongo’ npm site

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'store' of undefined in Javascript class
Getting back into web after doing mobile for the last four years so I'm a little rusty :) Thanks import React from 'react';...
Read more >
cannot read properties of null (reading 'store') - You.com
To solve the "Cannot read property 'value' of null" error, make sure that the JS script tag is placed at the bottom of...
Read more >
Cannot Read Property Length of Undefined in JavaScript
The JavaScript TypeError: Cannot read property 'length' of undefined occurs when the length property is read on an undefined variable.
Read more >
REDUX: Cannot read properties of undefined (reading 'type')
/store/index.js import {createStore} from "redux"; import reducer from "../reducers/index"; const initialState = { quotes: { "name1": "lorem ...
Read more >
How to Avoid the Infamous "Cannot read properties of ... - Bitovi
That error message is telling you the function is returning undefined implicitly, but its return type does not include undefined in it. Awesome!...
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