New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read property 'length' of undefined #11111
Comments
solved! |
@pedrogao What was the solution? Running in this myself. |
@nolan-m |
@MahmoudAbdo90 I had some unit tests that used Sequelize models, but I never loaded the file that initialized all them in the unit tests. |
I figured the problem out, It was a configuration problem. |
I was having the same problem. Because I was importing my Model as an instance. I just imported the class alone normal and if it was the error |
Solved here! I just forgot to add my new model inside my "models" array inside sequelize class configuration file, in my project this file is located at: src/database/index.js |
I did the same as @Cardoso-CHM |
@pedrogao Thanks! I was running into this problem and very much troubled to find the solution
and the User Model,
and create,
|
This was the solution to me! Many tanks! |
What are you doing?
To Reproduce
Steps to reproduce the behavior:
create
What do you expect to happen?
create an user successful!
What is actually happening?
there was an error! and happened on this line:
when creating an user, the constructor.primaryKeyAttributes is undefined,so why this caused.
Output, either JSON or SQL
no sql and no json, just crashed on the sequelize , the core file is
sequelize/lib/model.js
Environment
Dialect:
Dialect library version: 1.6.5
Database version: 5.7.24
Sequelize version: 5.3.5
Node Version: v10.15.3
OS: mac 10.14.5
If TypeScript related: TypeScript version: XXX
Tested with latest release:
The text was updated successfully, but these errors were encountered: