Here's my migration:
// @flow
'use strict';
module.exports = {
up: function(queryInterface, Sequelize) {
return queryInterface.createTable('Screencasts', {
id: {
primaryKey: true,
allowNull: false,
type: Sequelize.STRING
},
url: {
type: Sequelize.TEXT,
allowNull: false
},
title: {
type: Sequelize.STRING,
allowNull: false
},
description: {
type: Sequelize.TEXT,
allowNull: false
},
durationInSeconds: {
type: Sequelize.NUMBER,
allowNull: false
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: function(queryInterface, Sequelize) {
return queryInterface.dropTable('Screencasts');
}
};
When I run sequelize db:migrate, I get this error:
Sequelize [Node: 5.7.1, CLI: 2.3.1, ORM: 3.20.0]
Loaded configuration file "config/development.json".
Using gulpfile ~/.nvm/versions/node/v5.7.1/lib/node_modules/sequelize-cli/lib/gulpfile.js
== 20160330050618-create-screencast: migrating =======
[TypeError: Cannot read property 'length' of undefined]
[TypeError: Cannot read property 'length' of undefined] is not sufficient information for me to debug the problem :cry:
durationInSeconds: {
type: Sequelize.NUMBER,
allowNull: false
}
Just to be clear, I know what the problem is. I wrote NUMBER when I meant to write INTEGER.
I just used this as an example to illustrate the poor error message.
At lest when you make this error in regular Sequelize code (i.e. not within a migration), you get a callstack:

This is a huge issue for me as well. Would happily put together a PR if someone could point me in the right direction...
I ran into this exact same problem, good thing you also gave the answer to my problem @bookercodes.
This issue is related to Sequelize, CLI is just reporting error it encountered when running migrations
@sushantdhiman what is the relevant issue in Sequelize? Unable to debug my migration due to lack of call stack.
btw in v3.0.0 you can pass --debug and it will print call stack instead for error message https://github.com/sequelize/cli/releases/tag/v3.0.0
@thakkarparth007 There is no relevant issue in Sequelize as there can be infinite number of incorrect combination passed to an given method. We are trying to improve this where we can, Sequelize v4 is better at reporting correct cause of error than v3 in many cases
Most helpful comment
Just to be clear, I know what the problem is. I wrote
NUMBERwhen I meant to writeINTEGER.I just used this as an example to illustrate the poor error message.