You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I remember bun was implementing its SQLite API to be as close as possible to better-sqlite3, so explicitly passing the driver might help. Would this work?
This seems to be initialized successfully, but some errors occurred.
query: PRAGMA foreign_keys = OFF
query: BEGIN TRANSACTION
query: SELECT * FROM "sqlite_master" WHERE "type" = 'table' AND "name" IN ('user','user_passkey')
query: ROLLBACK
query: PRAGMA foreign_keys = ON
889 | promises.push(this.query(`SELECT * FROM "sqlite_master" WHERE "type" = '${type}' AND "${type === "table" ? "name":"tbl_name"}" IN (${tableNamesWithoutDot})`));
890 | }
891 |return promises;
892 | };
893 | dbTables = (await Promise.all(queryPromises("table")))
894 | .reduce((acc, res) => [...acc, ...res], []) ^TypeError: Spread syntax requires ...iterable[Symbol.iterator] to be a function at /Users/seepine/workspace/bun/rayze-template/node_modules/typeorm/driver/sqlite-abstract/AbstractSqliteQueryRunner.js:894:25 at reduce (1:11) at /Users/seepine/workspace/bun/rayze-template/node_modules/typeorm/driver/sqlite-abstract/AbstractSqliteQueryRunner.js:894:18889 | promises.push(this.query(`SELECT * FROM "sqlite_master" WHERE "type" = '${type}' AND "${type === "table" ? "name":"tbl_name"}" IN (${tableNamesWithoutDot})`));
890 | }
891 |return promises;
892 | };
893 | dbTables = (await Promise.all(queryPromises("table")))
894 | .reduce((acc, res) => [...acc, ...res], []) ^TypeError: Spread syntax requires ...iterable[Symbol.iterator] to be a function at /Users/seepine/workspace/bun/rayze-template/node_modules/typeorm/driver/sqlite-abstract/AbstractSqliteQueryRunner.js:894:25 at reduce (1:11) at /Users/seepine/workspace/bun/rayze-template/node_modules/typeorm/driver/sqlite-abstract/AbstractSqliteQueryRunner.js:894:18
You might be able to work around this issue and patch TypeORM - replace stmt.reader with query.startsWith("SELECT ") - that should cover about 95% of statements that return something (you don't use CTEs, do you? 😁). Also AbstractSqliteDriver.createParameter might need to be adjusted.
My experience in the past year with Bun was that most likely you will find another issue quite soon. 🤞🏻
Looking at Bun's API, I think there's an easier way to check if something returns data or not:
stmt.columnNames.length>0
This is similar to what better-sqlite3 does internally.
You would try patching TypeORM with the two changes (for createParameters and stmt.reader) and see what other issues you run into 🤷🏻. Maybe since SQLite is not that complex, there won't be much to do.
TypeORM has returned to active development after recently transitioning to new leadership (see related announcement).
As part of the new team's efforts to prioritise work on the project moving forward, it is necessary to clean up the backlog of stale issues.
🧹 This issue is being automatically closed because it has had no activity in the last 6 months.
If you believe this issue is still relevant, feel free to comment below and the maintainers may reopen it. Thank you for your contribution.
I think this can be implemented in a simpler way with an additional driver. Bun's sqlite client is indeed inspired by better-sqlite3, so with a few modifications to that driver (which itself is quite small) you can add bun support.
Activity
alumni commentedon Jan 13, 2025
I remember bun was implementing its SQLite API to be as close as possible to
better-sqlite3, so explicitly passing the driver might help. Would this work?There might be some other issues with bun though, since it's still not 100% compatible with node (e.g. bun is not importing typeorm correctly).
seepine commentedon Jan 13, 2025
@alumni Unfortunately, this doesn't work.
And try
This seems to be initialized successfully, but some errors occurred.
alumni commentedon Jan 13, 2025
@seepine The code that you wrote is correct. However, Bun does not implement the
Statement.readerproperty. I would suggest opening an issue for them.TypeORM uses
Statement.readerto check if a prepared statement returns something or not, and then call eitherStatement.all()orStatement.run()to execute that statement and get the results. Seenode_modules/typeorm/driver/better-sqlite3/BetterSqlite3QueryRunner.js:77-88or https://github.com/typeorm/typeorm/blob/0.3.20/src/driver/better-sqlite3/BetterSqlite3QueryRunner.ts#L94-L106You might be able to work around this issue and patch TypeORM - replace
stmt.readerwithquery.startsWith("SELECT ")- that should cover about 95% of statements that return something (you don't use CTEs, do you? 😁). AlsoAbstractSqliteDriver.createParametermight need to be adjusted.My experience in the past year with Bun was that most likely you will find another issue quite soon. 🤞🏻
seepine commentedon Jan 14, 2025
😧😧😧
Maybe using bun/sqlite is not a good idea...
alumni commentedon Jan 20, 2025
Looking at Bun's API, I think there's an easier way to check if something returns data or not:
This is similar to what
better-sqlite3does internally.You would try patching TypeORM with the two changes (for
createParametersandstmt.reader) and see what other issues you run into 🤷🏻. Maybe since SQLite is not that complex, there won't be much to do.github-actions commentedon Sep 17, 2025
TypeORM has returned to active development after recently transitioning to new leadership (see related announcement).
As part of the new team's efforts to prioritise work on the project moving forward, it is necessary to clean up the backlog of stale issues.
🧹 This issue is being automatically closed because it has had no activity in the last 6 months.
If you believe this issue is still relevant, feel free to comment below and the maintainers may reopen it. Thank you for your contribution.
seepine commentedon Sep 20, 2025
Maybe wait this done.
oven-sh/bun#2023
#10684
alumni commentedon Dec 1, 2025
I think this can be implemented in a simpler way with an additional driver. Bun's
sqliteclient is indeed inspired bybetter-sqlite3, so with a few modifications to that driver (which itself is quite small) you can add bun support.jappyjan commentedon Dec 18, 2025
i would like to see a native bun driver too
trashhead commentedon Jun 26, 2026
Any updates on this?
seepine commentedon Oct 17, 2026
The bun issue oven-sh/bun#16469 has been resolved;
I'll give it a try to see whether it is supported now.