billowdev / mineimages-react

simple react app | Project implementation be part of the Web Development Course
0 stars 0 forks source link

Errror After send request to Order route #20

Closed billowdev closed 2 years ago

billowdev commented 2 years ago
node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

Error
    at Query.run (D:\GitHub\mineimages\server\node_modules\sequelize\lib\dialects\mysql\query.js:52:25)
    at D:\GitHub\mineimages\server\node_modules\sequelize\lib\sequelize.js:313:28
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async MySQLQueryInterface.insert (D:\GitHub\mineimages\server\node_modules\sequelize\lib\dialects\abstract\query-interface.js:297:21)
    at async model.save (D:\GitHub\mineimages\server\node_modules\sequelize\lib\model.js:2417:35)
    at async Function.create (D:\GitHub\mineimages\server\node_modules\sequelize\lib\model.js:1329:12)
    at async D:\GitHub\mineimages\server\routes\Orders.js:27:3 {
  name: 'SequelizeUniqueConstraintError',
  errors: [
    ValidationErrorItem {
      message: 'ImageId must be unique',
      type: 'unique violation',
      path: 'ImageId',
      value: '72da0f17',
      origin: 'DB',
      instance: Orders {
        dataValues: {
          id: null,
          ImageId: '72da0f17-b0f0-4836-b574-27fbe5039b1b',
          UserId: '6ebcf485-1b5d-4be3-8644-a5ee37c0edde',
          TransactionId: 'f74ab0c0-a05e-11ec-987f-bdeb6e48e81d',
          updatedAt: 2022-03-10T10:43:47.805Z,
          createdAt: 2022-03-10T10:43:47.805Z
        },
        _previousDataValues: {
          ImageId: undefined,
          UserId: undefined,
          TransactionId: undefined
        },
        uniqno: 1,
        _changed: Set(3) { 'ImageId', 'UserId', 'TransactionId' },
        _options: {
          isNewRecord: true,
          _schema: null,
          _schemaDelimiter: '',
          attributes: undefined,
          include: undefined,
          raw: undefined,
          silent: undefined
        },
        isNewRecord: true
      },
      validatorKey: 'not_unique',
      validatorName: null,
      validatorArgs: []
    },
    ValidationErrorItem {
      message: 'UserId must be unique',
      type: 'unique violation',
      path: 'UserId',
      value: 'b0f0',
      origin: 'DB',
      instance: Orders {
        dataValues: {
          id: null,
          ImageId: '72da0f17-b0f0-4836-b574-27fbe5039b1b',
          UserId: '6ebcf485-1b5d-4be3-8644-a5ee37c0edde',
          TransactionId: 'f74ab0c0-a05e-11ec-987f-bdeb6e48e81d',
          updatedAt: 2022-03-10T10:43:47.805Z,
          createdAt: 2022-03-10T10:43:47.805Z
        },
        _previousDataValues: {
          ImageId: undefined,
          UserId: undefined,
          TransactionId: undefined
        },
        uniqno: 1,
        _changed: Set(3) { 'ImageId', 'UserId', 'TransactionId' },
        _options: {
          isNewRecord: true,
          _schema: null,
          _schemaDelimiter: '',
          attributes: undefined,
          include: undefined,
          raw: undefined,
          silent: undefined
        },
        isNewRecord: true
      },
      validatorKey: 'not_unique',
      validatorName: null,
      validatorArgs: []
    }
  ],
  parent: Error: Duplicate entry '72da0f17-b0f0-4836-b574-27fbe5039b1b-6ebcf485-1b5d-4be3-8644-...' for key 'Orders_UserId_ImageId_unique'
      at Packet.asError (D:\GitHub\mineimages\server\node_modules\mysql2\lib\packets\packet.js:728:17)
      at Execute.execute (D:\GitHub\mineimages\server\node_modules\mysql2\lib\commands\command.js:29:26)
      at Connection.handlePacket (D:\GitHub\mineimages\server\node_modules\mysql2\lib\connection.js:456:32)
      at PacketParser.onPacket (D:\GitHub\mineimages\server\node_modules\mysql2\lib\connection.js:85:12)
      at PacketParser.executeStart (D:\GitHub\mineimages\server\node_modules\mysql2\lib\packet_parser.js:75:16)
      at Socket.<anonymous> (D:\GitHub\mineimages\server\node_modules\mysql2\lib\connection.js:92:25)
      at Socket.emit (node:events:390:28)
      at addChunk (node:internal/streams/readable:315:12)
      at readableAddChunk (node:internal/streams/readable:289:9)
      at Socket.Readable.push (node:internal/streams/readable:228:10) {
    code: 'ER_DUP_ENTRY',
    errno: 1062,
    sqlState: '23000',
    sqlMessage: "Duplicate entry '72da0f17-b0f0-4836-b574-27fbe5039b1b-6ebcf485-1b5d-4be3-8644-...' for key 'Orders_UserId_ImageId_unique'",
    sql: 'INSERT INTO `Orders` (`id`,`createdAt`,`updatedAt`,`ImageId`,`UserId`,`TransactionId`) VALUES (DEFAULT,?,?,?,?,?);',
    parameters: [
      '2022-03-10 10:43:47',
      '2022-03-10 10:43:47',
      '72da0f17-b0f0-4836-b574-27fbe5039b1b',
      '6ebcf485-1b5d-4be3-8644-a5ee37c0edde',
      at readableAddChunk (node:internal/streams/readable:289:9)
      at Socket.Readable.push (node:internal/streams/readable:228:10) {
    code: 'ER_DUP_ENTRY',
    errno: 1062,
    sqlState: '23000',
    sqlMessage: "Duplicate entry '72da0f17-b0f0-4836-b574-27fbe5039b1b-6ebcf485-1b5d-4be3-8644-...' for key 'Orders_UserId_ImageId_unique'",
    sql: 'INSERT INTO `Orders` (`id`,`createdAt`,`updatedAt`,`ImageId`,`UserId`,`TransactionId`) VALUES (DEFAULT,?,?,?,?,?);',
    parameters: [
      '2022-03-10 10:43:47',
      '2022-03-10 10:43:47',
      '72da0f17-b0f0-4836-b574-27fbe5039b1b',
      '6ebcf485-1b5d-4be3-8644-a5ee37c0edde',
      'f74ab0c0-a05e-11ec-987f-bdeb6e48e81d'
    ]
  },
  fields: { ImageId: '72da0f17', UserId: 'b0f0' },
  sql: 'INSERT INTO `Orders` (`id`,`createdAt`,`updatedAt`,`ImageId`,`UserId`,`TransactionId`) VALUES (DEFAULT,?,?,?,?,?);'
}
[nodemon] app crashed - waiting for file changes before starting...