You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See nice error telling me that I did not put a type for the elements of the array.
What is actually happening?
Unhandled error cannot read property key of undefined
TypeError: Cannot read property 'key' of undefined
at Sequelize.Object.<anonymous>.Sequelize.normalizeDataType (node_modules/sequelize/lib/sequelize.js:1366:64)
at Sequelize.Object.<anonymous>.Sequelize.normalizeAttribute (node_modules/sequelize/lib/sequelize.js:1378:25)
at Model.<anonymous> (node_modules/sequelize/lib/model.js:84:32)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment 🙂
Activity
austinyearlykim commentedon Aug 24, 2017
it is erroring at
if (type instanceof DataTypes.ARRAY && dialectTypes[type.type.key]) {hmmm.
austinyearlykim commentedon Aug 24, 2017
Got it. @RaulTsc
You need to add a type for your array. What type are the values held by it?
Here is something of the sort below:
acceptedCandidates: { type: Sequelize.ARRAY(Sequelize.TEXT), field: 'accepted_candidates', allowNull: false, },yay
stale commentedon Sep 23, 2017
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment 🙂
raultomescu commentedon Sep 30, 2017
Makes sense @austindebruyn . Still, it's a weird error message. A nice message would be useful.
austindebruyn commentedon Sep 30, 2017
You most likely meant to tag @austinyearlykim 😃
alexanmtz commentedon Apr 4, 2018
In my case I was using array that is supported just by postgres and in my local env is not supported, so after remove the array datatype it works
sushantdhiman commentedon Sep 8, 2018
Fixed by #9649