Experiencing a runtime error when saving documents that use the mongoose-bcrypt plugin for password hashing. The error occurs in production on AWS Lambda. Error Stack Trace:
{
"errorType": "TypeError",
"errorMessage": "next is not a function",
"stack": [
"TypeError: next is not a function",
" at model.<anonymous> (/var/task/node_modules/mongoose-bcrypt/index.js:115:7)",
" at Kareem.execPre (/var/task/node_modules/kareem/index.js:63:39)",
" at async model.$__save (/var/task/node_modules/mongoose/lib/model.js:369:5)",
" at async model.save (/var/task/node_modules/mongoose/lib/model.js:609:5)",
]
}
Current Environment:
Mongoose: 9.1.3
mongoose-bcrypt: 1.11.0
Node.js: 22.x
Runtime: AWS Lambda