I got the same error. It took several hours to troubleshoot. The below code worked for me. However, it requires adding "return User" in your js file that contains the User object. In my case, it's in my user.js file.
So, my index.js file code snippet looks like this:
I got the same error. It took several hours to troubleshoot. The below code worked for me. However, it requires adding "return User" in your js file that contains the User object. In my case, it's in my user.js file.
So, my index.js file code snippet looks like this:
.forEach((file) => {
const model = sequelize.import(path.join(__dirname, file))
console.log("model " + model)
try {
db[model.name] = model
console.log("working")
} catch (err) {
console.error(err)
}
My user.js file contains this important line of code: