title: Unhandled rejection SequelizeUniqueConstraintError: Validation error
body: <p>I'm getting this error:</p>
  
  <pre><code>Unhandled rejection SequelizeUniqueConstraintError: Validation error
  </code></pre>
  
  <p>How can I fix this?</p>
  
  <p>This is my models/user.js</p>
  
  <pre><code>"use strict";
  
  module.exports = function(sequelize, DataTypes) {
    var User = sequelize.define("User", {
      id:  { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true},
      name: DataTypes.STRING,
      environment_hash: DataTypes.STRING
    }, {
      tableName: 'users',
      underscored: false,
      timestamps: false
    }
  
    );
  
    return User;
  };
  </code></pre>
  
  <p>And this is my routes.js:</p>
  
  <pre><code>app.post('/signup', function(request, response){
  
          console.log(request.body.email);
          console.log(request.body.password);
  
          User
          .find({ where: { name: request.body.email } })
              .then(function(err, user) {
                  if (!user) {
                          console.log('No user has been found.');
  
                          User.create({ name: request.body.email }).then(function(user) {
                              // you can now access the newly created task via the variable task
                              console.log('success');
                          });
  
                  } 
              });
  
  
  
      });
  </code></pre>