-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Creating afterUpdate hook using the mixin function causes TypeError #3901
Copy link
Copy link
Closed
Labels
type: bugDEPRECATED: replace with the "bug" issue typeDEPRECATED: replace with the "bug" issue type
Description
db.Version.addHook( 'afterUpdate', 'update_CurrentVersion', update_CurrentVersion );
db.Version.afterUpdate( 'update_CurrentVersion', update_CurrentVersion );
The first runs correctly, the second causes this error:
Unhandled rejection TypeError: Cannot read property 'length' of undefined
at /home/dannii/i7el/node_modules/sequelize/lib/hooks.js:125:27
From previous event:
at Function.each (/home/dannii/i7el/node_modules/sequelize/lib/promise.js:21:17)
at Hooks.runHooks (/home/dannii/i7el/node_modules/sequelize/lib/hooks.js:120:27)
at self.sequelize.getQueryInterface.apply.then.tap.then.options.fields.forEach.result._previousDataValues.(anonymous function) (/home/dannii/i7el/node_modules/sequelize/lib/instance.js:672:31)
From previous event:
at Promise.tap (/home/dannii/i7el/node_modules/sequelize/lib/promise.js:21:17)
at null.<anonymous> (/home/dannii/i7el/node_modules/sequelize/lib/instance.js:669:10)
From previous event:
at Promise.then (/home/dannii/i7el/node_modules/sequelize/lib/promise.js:21:17)
at Instance.save (/home/dannii/i7el/node_modules/sequelize/lib/instance.js:558:6)
at Object.<anonymous> (/home/dannii/i7el/web/controllers/extensions.js:175:16)
From previous event:
at Promise.spread (/home/dannii/i7el/node_modules/sequelize/lib/promise.js:21:17)
at create (/home/dannii/i7el/web/controllers/extensions.js:143:5)
at Layer.handle [as handle_request] (/home/dannii/i7el/node_modules/express/lib/router/layer.js:82:5)
at next (/home/dannii/i7el/node_modules/express/lib/router/route.js:110:13)
at onFinish (/home/dannii/i7el/node_modules/multer/index.js:211:16)
at Busboy.<anonymous> (/home/dannii/i7el/node_modules/multer/index.js:188:9)
at Busboy.emit (events.js:117:20)
at Busboy.emit (/home/dannii/i7el/node_modules/multer/node_modules/busboy/lib/main.js:31:35)
at /home/dannii/i7el/node_modules/multer/node_modules/busboy/lib/types/multipart.js:52:13
at process._tickCallback (node.js:448:13)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type: bugDEPRECATED: replace with the "bug" issue typeDEPRECATED: replace with the "bug" issue type