2017-12-21 14 views
0

の私はモデル内で一意の列を定義したとき、私は、sequelizeでGraphJSを使用しています:Sequelize、GraphJS:プロパティを読み取ることができません「2」ヌル

const Product = Connection.define('Product', { 
    label: { 
     type: Sequelize.STRING, 
     allowNull: false, 
     unique: true <-------------- 
    }, 
    description: { 
     type: Sequelize.TEXT, 
     allowNull: false 
    }, 
    price: { 
     type: Sequelize.FLOAT(6, 3), 
    } 
}); 

私はしようとすると、秒を挿入同じラベル行:

const Mutations = new GraphQLObjectType({ 
    name: 'Mutations', 
    description: 'All Mutations', 
    fields:() => { 
     return { 
      addProduct: { 
       type: Product, 
       args: { 
        new: { 
         name: 'New product', 
         type: ProductInput 
        } 
       }, 
       resolve(_, args) { 
        return Db.models.Product.create(args.new); 
       } 
      }, 
     }; 
    } 
}); 

は、私は次のエラーを得ました

TypeError: Cannot read property '2' of null 

アイデア?あなたはいけない

+0

多分挿入コードを表示? – hereandnow78

+0

'constの変異=新しいGraphQLObjectType({ 名: '変異'、 説明: 'すべての変異'、 フィールド:()=> { リターン{ addProduct:{ タイプ:製品、 引数:{ 新しいです:{ 名: '新製品'、 タイプ:ProductInput }}、 解決(_、引数){ リターンDb.models.Product.create(args.new); }}、 }。 } }); ' –

答えて

0

は、問題が発生しただけのように見える:

https://github.com/sequelize/sequelize/issues/6725

https://github.com/feathersjs-ecosystem/feathers-sequelize/issues/71

はあなたにもMySQLを使用して行い、そしてそうであればどのバージョン?

いくつかのバージョンで動作しているようですし、いくつかないで:

https://github.com/feathersjs-ecosystem/feathers-sequelize/issues/71#issuecomment-255192417

+0

私は5.7.14を使用しています... –

関連する問題