Tuesday, 25 April 2017

sequelize.synch returns Got error 168 from storage engine

I got a nodeJS application with a MySQL DB on a Linux (Ubunut 16.04 LTS). I'm using sequelize (3.23.0) to do DB manipulation (create, update, etc.)

I got an error message when the following code gets executed (file is called "initSequelize.js"):

db
.sequelize
.sync({alter:true})
.finally(function(err){
  if (err) {
    console.log("init sequelize error");
    throw err[0];
  } else {
    console.log("foo sequelize");
  }
})
.catch(function(error){
  console.log("uh oh in Sequelize: ", error);
});

The error message:

foo sequelize

uh oh in Sequelize: {SequelizeDatabaseError: ER_GET_ERRNO: Got error 168 from storage engine

As you can see, it goes into the else clause and then throws that error. But in the else clause is nothing that could cause an error.

At first I thought I'm running short of storage. Therefore I deleted not needed files. But the error still shows.

Further below I would see this error message:

From previous event: at Promise.then (/home/path/to/project/node_modules/sequelize/lib/promise.js:21:17) at Sequelize.sync (/home/path/to/project/node_modules/sequelize/lib/sequelize.js:995:6) at database (/home/path/to/project/init/initSequelize.js:11:6)

Line 11 is referring to ".sync" in the code above

I also deleted my whole project and cloned the project again, deleted the whole MySQL database and re-created an empty one (basically start from scratch). Yet the error still persists.



via thadeuszlay

No comments:

Post a Comment