Closed fccruz closed 5 years ago
@fccruz Can you provide an example repo, which reproduces the issue? I couldn't.
@fccruz try return res.send(user.toJSON());
Did you manage to solve the problem? I have the same issue.
@morrigan Can you provide an example repo which reproduces the issue?
@morrigan did you try return res.send(user.toJSON());
?
I had exactly the same problem and managed to avoid it simply by running toJSON()
on the instance first.
@RobinBuschmann https://github.com/morrigan/mythx-vulnerability-monitor/blob/master/src/Models/User.ts
@mmiszy yes, same thing
happens to me on the latest version after doing toJSON or it equivalent get({plain: true})
@morrigan @OrenSchwartz I've released a new beta version (npm i sequelize-typescript@0.6.11-beta.1
) which should fix at least the issue morrigan had. Can you confirm?
@RobinBuschmann I was having the same issue, testing the beta now. I'll let you know the results in the next 24 hours :)
@RobinBuschmann Fix seems to be good, no exceptions in the past 29 hours of using it :) , thanks.
fix seems to be good.
I'm closing this, since the fix was released with sequelize-typescript@0.6.11
Hi,
Every time I try to get a simple query, I get the next error
TypeError: Cannot read property 'include' of undefined at Model.get (/admin/node_modules/sequelize/lib/model.js:3248:66) at Model.toJSON (/admin/node_modules/sequelize/lib/model.js:4101:12) at JSON.stringify ()
at stringify (/admin/node_modules/fast-safe-stringify/index.js:11:18)
at Format.module.exports.format [as transform] (/admin/node_modules/logform/json.js:24:19)
at Format.info [as transform] (/admin/node_modules/logform/combine.js:20:24)
at DerivedLogger._transform (/admin/node_modules/winston/lib/winston/logger.js:305:29)
at DerivedLogger.Transform._read (/admin/node_modules/winston/node_modules/readable-stream/lib/_stream_transform.js:177:10)
at DerivedLogger.Transform._write (/admin/node_modules/winston/node_modules/readable-stream/lib/_stream_transform.js:164:83)
at doWrite (/admin/node_modules/winston/node_modules/readable-stream/lib/_stream_writable.js:405:139)
at writeOrBuffer (/admin/node_modules/winston/node_modules/readable-stream/lib/_stream_writable.js:394:5)
at DerivedLogger.Writable.write (/admin/node_modules/winston/node_modules/readable-stream/lib/_stream_writable.js:303:11)
at DerivedLogger.log (/admin/node_modules/winston/lib/winston/logger.js:244:14)
at DerivedLogger.(anonymous function) (/admin/node_modules/winston/lib/winston/create-logger.js:95:19)
at Sequelize.log (/admin/node_modules/sequelize/lib/sequelize.js:1091:23)
at Query.run (/admin/node_modules/sequelize/lib/dialects/mysql/query.js:52:22)
at Promise.try.then.connection (/admin/node_modules/sequelize/lib/sequelize.js:558:20)
at tryCatcher (/admin/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/admin/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/admin/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/admin/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/admin/node_modules/bluebird/js/release/promise.js:694:18)
these are the models
and this is the query
Edit: Also when i run the query without the include key it works normally
Thank you in advance