Open miniBill opened 3 months ago
I get the same error if I try to run this with node 20.15.1
If I replace the close
+ callback with
db.once("error", reject);
db.once("close", resolve);
db.close();
I get a different error when running the first line:
Might it be because _events
is null
?
The issue seems to go away if I instead of giving a callback to open
I use db.once
to wait for the database to be correctly opened (in which case, _events
is not null
)
Yeah, it seems to be an issue with giving a callback to open
. If I replace the open code to:
const db = new sqlite3.Database(filename);
return await new Promise<sqlite3.Database>((resolve, reject) => {
const error = function () {
db.off("open", success);
db.off("error", error);
reject();
};
const success = function () {
db.off("open", success);
db.off("error", error);
resolve(db);
};
db.on("error", error);
db.on("open", success);
});
then everything works correctly, including using callbacks for the other operations.
Issue Summary
When I call
I get the error:
The value of
db
isSteps to Reproduce
Version
5.1.7
Node.js Version
18.20.4
How did you install the library?
yarn add sqlite3