Open real-zit opened 3 years ago
TypeError: Cannot read property '_id' of undefined in global variable id is not found in the helpers editIcon function
What view did you have this error?
Ensure you have the middleware in app.js file
app.use((req, res, next)=> { res.locals.user = req.user || null; next() })
Also, ensure all queries to MongoDB is async with await. I forgot to put await when using async and it gave me the same error you have
TypeError: Cannot read property '_id' of undefined in global variable id is not found in the helpers editIcon function
TypeError: Cannot read property '_id' of undefined in global variable id is not found in the helpers editIcon function
What view did you have this error?
Ensure you have the middleware in app.js file
app.use((req, res, next)=> { res.locals.user = req.user || null; next() })
Also, ensure all queries to MongoDB is async with await. I forgot to put await when using async and it gave me the same error you have
the public story view file is showing the error
already used the app.use((req, res, next)=> { res.locals.user = req.user || null; next() })
in app.js file
Any solutions?
TypeError: Cannot read property '_id' of undefined in global variable id is not found in the helpers editIcon function