node-email-verification icon indicating copy to clipboard operation
node-email-verification copied to clipboard

TypeError: Cannot read property 'paths' of undefined

Open Caruso33 opened this issue 6 years ago • 0 comments

Object.generateTempUserModel (node_modules/email-verification/index.js:172:29) runs into problems:

(node_modules/email-verification/index.js:172
 Object.keys(User.schema.paths).forEach(function(field) {

TypeError: Cannot read property 'paths' of undefined

I use node-email-verification for the first time and just updated all npm packages, hence my mongoose version is 5.1.5 which might break the index.js file.

I see that the User model from mongoose now returns User.User.schema....not User.schema. If that is changed on several places, however, the next thing is the callback function:

node_modules/email-verification/index.js:221
return callback(null, mongoose.model(options.tempUserCollection));
^

TypeError: callback is not a function
at Object.generateTempUserModel (node_modules/email-verification/index.js:221:12)

Any ideas how to fix this?

Caruso33 avatar Jun 16 '18 11:06 Caruso33