Facing DatabaseError [SequelizeDatabaseError]: SQLITE_ERROR: no such table: Wallets , while doing npm start after npm install. Also tried changing access rights but got similar error.[🐛]
See original GitHub issueC:\Users\Dheeraj Verma\Development_Projects\Node_Projects\juice-shop\node_modules\sequelize\lib\dialects\sqlite\query.js:403 return new sequelizeErrors.DatabaseError(err); ^
DatabaseError [SequelizeDatabaseError]: SQLITE_ERROR: no such table: Wallets
at Query.formatError (C:\Users\Dheeraj Verma\Development_Projects\Node_Projects\juice-shop\node_modules\sequelize\lib\dialects\sqlite\query.js:403:16)
at Query._handleQueryResponse (C:\Users\Dheeraj Verma\Development_Projects\Node_Projects\juice-shop\node_modules\sequelize\lib\dialects\sqlite\query.js:72:18)
at afterExecute (C:\Users\Dheeraj Verma\Development_Projects\Node_Projects\juice-shop\node_modules\sequelize\lib\dialects\sqlite\query.js:238:27)
at Statement.errBack (C:\Users\Dheeraj Verma\Development_Projects\Node_Projects\juice-shop\node_modules\sqlite3\lib\sqlite3.js:14:21) {
parent: [Error: SQLITE_ERROR: no such table: Wallets] {
errno: 1,
code: ‘SQLITE_ERROR’,
sql: ‘SELECT sum(balance
) AS sum
FROM Wallets
AS Wallet
;’
},
original: [Error: SQLITE_ERROR: no such table: Wallets] {
errno: 1,
code: ‘SQLITE_ERROR’,
sql: ‘SELECT sum(balance
) AS sum
FROM Wallets
AS Wallet
;’
},
sql: ‘SELECT sum(balance
) AS sum
FROM Wallets
AS Wallet
;’,
parameters: undefined
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (7 by maintainers)
Top GitHub Comments
Haha. No offensive taken! 😃
I’ve been looking at this all day and I believe the race condition is between the initial database
sequelize.sync()
and the metrics loop instantiation. Delaying the metric loops instantiation is working for me. Previously, it looks like the metric loop was getting instantiated during module import which was then causing it to race with the startup code which does thesequelize.sync()
. Not ready to submit this as a PR but would love some feedback and would be happy to continue working on this.Here are logs from when this race happens. These happen right after an
npm start
. You can see the existing tables all get dropped and begin to get re-created on startup. During that process you can also see the metrics loop start up and the loop is often looking for theWallet
table but sometimes it is other tables depending on what pointsequelize.sync()
has been able to proceed.This looks very promising! My last attempt was waiting for the entity creation, but it seems that didn’t even trigger the DB reset… 😅 …
info: Entity models 19 of 19 are initialized
was supposed to be where the DB is ready… 😀