New file.sqlite database files are now created empty and are invalid.
Every twitch chat or discord chat message causes an error.
(node:695) UnhandledPromiseRejectionWarning: SequelizeDatabaseError: SQLITE_ERROR: no such table: customs
at Query.formatError (/rbd/pnpm-volume/4f6c3f9f-debe-43cb-8620-073ae5f3fcbd/node_modules/.registry.npmjs.org/sequelize/5.16.0/node_modules/sequelize/lib/dialects/sqlite/query.js:419:16)
at Query._handleQueryResponse (/rbd/pnpm-volume/4f6c3f9f-debe-43cb-8620-073ae5f3fcbd/node_modules/.registry.npmjs.org/sequelize/5.16.0/node_modules/sequelize/lib/dialects/sqlite/query.js:73:18)
at afterExecute (/rbd/pnpm-volume/4f6c3f9f-debe-43cb-8620-073ae5f3fcbd/node_modules/.registry.npmjs.org/sequelize/5.16.0/node_modules/sequelize/lib/dialects/sqlite/query.js:247:31)
at Statement.errBack (/rbd/pnpm-volume/4f6c3f9f-debe-43cb-8620-073ae5f3fcbd/node_modules/.registry.npmjs.org/sqlite3/4.1.0/node_modules/sqlite3/lib/sqlite3.js:16:21)
(node:695) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:695) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
That message indicates that your database is findable but doesnât include the table youâre looking for, which I believe youâve understood. In order for us to help, though, I think weâll need to understand more about how your database files are created. Can you provide your project name so that folks can take a look at your code, or barring that at least post the code that you expect to be creating those database files?
In the code you posted youâre initializing a table called custom but in the error message your code is looking for a table called customs. Is it possible thereâs a table name mismatch somewhere else in your code?
Did you maybe move the code that runs this, to another folder? The dot in the path means âcurrent directoryâ, so this path may have changed by rearranging the code. Could try a path of /app/discord/commands/custom/data.sqlite
Donât forget to add your data folders to .gitignore.
That occurred to me as well, but the path resolution may be from where the top-level code is being called from and not where the code thatâs accessing the database files is located. Also Iâd expect a different error message if the data file just canât be found. Itâs definitely worth trying the absolute path, I just wouldnât expect it to resolve the issue.
Iâm curious if thereâs anything else in the logs around the snippet youâve shared thus far, @AndriyMeleshko, that might point us to the place in your code that the sequelize promise thatâs being rejected is called. If you want to share your project name we can also take a look at the code and errors in context.
SQLite is often setup so that if the data file is not found, it automatically creates a new one. Then, if the table names in the auto create code are different from those in the query code, the error about no such table would occur.
Hello @mishavee@cori
I used âRewindâ to restore old database files.
Only one didnât work. I was surprised but it started working. The address of this file is ./twitch/welcome/data.sqlite
Unfortunately, files that are automatically created are visible in a few hours.
My project: https://glitch.com/~carlita
Channel for commands testing: https://www.twitch.tv/carlita_desperado
Sorry, but the answers are in Ukrainian.
Iâll try the way later /app/discord/commands/custom/data.sqlite
Thanks for the tips!
Hello @cori and @mishavee
Iâm not sure, but it may be my mistake.
When I forget to add â.sync ()â, I get the same error.
Thanks for your time and tips. Sorry.