mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-09-11 18:47:29 +03:00
Fix SQLite agent hard crashing if db file does not exist
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8364 GitOrigin-RevId: db56baaa11d79f5324bcdb39e7975920daeb7d62
This commit is contained in:
parent
50fa303783
commit
c1ea1ea5e6
@ -26,7 +26,15 @@ export async function withConnection<Result>(config: Config, mode: number, sqlLo
|
||||
}
|
||||
}
|
||||
|
||||
const db_ = new SQLite.Database(config.db, mode);
|
||||
const db_ = await new Promise<SQLite.Database>((resolve, reject) => {
|
||||
const db = new SQLite.Database(config.db, mode, err => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve(db);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// NOTE: Avoiding util.promisify as this seems to be causing connection failures.
|
||||
const query = (query: string, params?: Record<string, unknown>): Promise<Array<any>> => {
|
||||
|
Loading…
Reference in New Issue
Block a user