Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database init fails on first/second try #16

Open
bwachter opened this issue Jun 13, 2023 · 6 comments
Open

Database init fails on first/second try #16

bwachter opened this issue Jun 13, 2023 · 6 comments

Comments

@bwachter
Copy link
Contributor

Works fine in memory, on disk tends to take one or two start attempts for it to finish initialisation.

Initializing DB
/home/bwachter/git/aard/lemmy-reddit-bot/node_modules/lemmy-bot/dist/db.js:43
const getRow = (db, id, table) => new Promise((resolve, reject) => {
                                  ^
Error: SQLITE_ERROR: no such table: posts
--> in Database#get('SELECT id, reprocessTime FROM posts WHERE id=?;', 54, [Function (anonymous)])
    at /home/bwachter/git/aard/lemmy-reddit-bot/node_modules/lemmy-bot/dist/db.js:44:8
    at new Promise (<anonymous>)
    at getRow (/home/bwachter/git/aard/lemmy-reddit-bot/node_modules/lemmy-bot/dist/db.js:43:35)
    at /home/bwachter/git/aard/lemmy-reddit-bot/node_modules/lemmy-bot/dist/db.js:74:88
    at Generator.next (<anonymous>)
    at /home/bwachter/git/aard/lemmy-reddit-bot/node_modules/lemmy-bot/dist/db.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/bwachter/git/aard/lemmy-reddit-bot/node_modules/lemmy-bot/dist/db.js:4:12)
    at get (/home/bwachter/git/aard/lemmy-reddit-bot/node_modules/lemmy-bot/dist/db.js:74:26)
    at get (/home/bwachter/git/aard/lemmy-reddit-bot/node_modules/lemmy-bot/dist/db.js:102:26)
    at LemmyBot.<anonymous> (/home/bwachter/git/aard/lemmy-reddit-bot/node_modules/lemmy-bot/dist/bot.js:988:35)
    at Generator.next (<anonymous>)
    at /home/bwachter/git/aard/lemmy-reddit-bot/node_modules/lemmy-bot/dist/bot.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/bwachter/git/aard/lemmy-reddit-bot/node_modules/lemmy-bot/dist/bot.js:4:12)
    at LemmyBot._LemmyBot_handleEntry (/home/bwachter/git/aard/lemmy-reddit-bot/node_modules/lemmy-bot/dist/bot.js:987:12)
    at LemmyBot.<anonymous> (/home/bwachter/git/aard/lemmy-reddit-bot/node_modules/lemmy-bot/dist/bot.js:505:129)
    at Generator.next (<anonymous>)
    at /home/bwachter/git/aard/lemmy-reddit-bot/node_modules/lemmy-bot/dist/bot.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/bwachter/git/aard/lemmy-reddit-bot/node_modules/lemmy-bot/dist/bot.js:4:12)
    at /home/bwachter/git/aard/lemmy-reddit-bot/node_modules/lemmy-bot/dist/bot.js:503:64
    at Array.map (<anonymous>)
    at LemmyBot.<anonymous> (/home/bwachter/git/aard/lemmy-reddit-bot/node_modules/lemmy-bot/dist/bot.js:503:46)
    at Generator.next (<anonymous>)
    at /home/bwachter/git/aard/lemmy-reddit-bot/node_modules/lemmy-bot/dist/bot.js:8:71
    at new Promise (<anonymous>) {
  errno: 1,
  code: 'SQLITE_ERROR',
  __augmented: true
}
@SleeplessOne1917
Copy link
Owner

I'm unable to reproduce this issue. Did you create the file you wanted to use as a DB before starting the bot, or did you let the bot create it?

@bwachter
Copy link
Contributor Author

bwachter commented Jul 3, 2023

I let the bot create it. I pretty reliably get this every time I remove the sqlite file before starting the bot. The code is here, if you want to have a look: https://github.com/r-sauna/lemmy-reddit-bot

@SleeplessOne1917
Copy link
Owner

While I haven't gotten to running your bot I noticed that you're using a fork that is 18 commits behind the upstream and doesn't have the latest changes to support 0.18.x Lemmy instances. Do you still get the error if you update the dependency?

@bwachter
Copy link
Contributor Author

bwachter commented Jul 9, 2023

I'll set up a dev environment to check that in a few days - but I'd guess it won't change anything: The reason I'm using the fork (and added the prepare script) was that I was hoping the issue was fixed in latest head at that point.

@bwachter
Copy link
Contributor Author

It can create a DB now - I guess this got accidentally fixed by dropping websockets. I assume before events started coming in before the database was ready, which doesn't happen anymore.

Unfortunately with the new version I don't get any events coming in (and based on the issue tracker I'm not alone in that). I also get an error on startup when I'm using minutesBeforeRetryConnection in the connection options.

@SleeplessOne1917
Copy link
Owner

@bwachter Do you still run into this issue? Your most recent comment mentions websockets, which were removed from Lemmy's API the better part of a year ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants