Bun, Prisma & Rust free engine errors
Im using bun, sqlite & Prisma and trying to use the new rust free engine. However when I use the better-sqlite3 adapter im returned with this error:
Any clues if this ABI mismatch can be resolved? or if we can use Bun built in driver?
4 Replies
You've gone full bot mode! Let me fetch that AI answer for you ASAP.
The error you're seeing is due to an ABI (Application Binary Interface) mismatch: the better-sqlite3 native module was compiled for a different Node.js ABI version than what Bun expects. This is a common issue when using native Node.js modules in alternative runtimes like Bun, especially as Bun's ABI version may differ from Node.js.
How to resolve:
- Rebuild better-sqlite3 for Bun: Try deleting your node_modules and lockfile, then reinstall dependencies using Bun, which should trigger a rebuild of native modules for Bun's ABI:
This often resolves ABI mismatches for supported modules.
- Check better-sqlite3 compatibility: Not all native Node.js modules are fully compatible with Bun yet. If the rebuild doesn't work, it's possible that better-sqlite3 doesn't support Bun's ABI or Bun's native module system at this time. The knowledge sources do not confirm full compatibility between better-sqlite3 and Bun, only that Bun is supported for Prisma's Rust-free engine in general, and that better-sqlite3 is the recommended adapter for SQLite in the new architecture Docs: SQLite, Blog: Rust-free ORM.
- Bun's built-in SQLite driver: The knowledge sources do not mention support for using Bun's built-in SQLite driver directly with Prisma. Prisma's Rust-free engine currently relies on the better-sqlite3 adapter for SQLite, not Bun's internal driver.
Summary:
You should try reinstalling dependencies with Bun to trigger a rebuild. If the error persists, it likely means better-sqlite3 is not yet compatible with Bun's ABI, and there is currently no official way to use Bun's built-in SQLite driver with Prisma. Keep an eye on updates from both Bun and Prisma for improved compatibility in the future. If you ne ed a working setup today, consider using Node.js until Bun and better-sqlite3 compatibility is confirmed. 🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly. In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.
You should try reinstalling dependencies with Bun to trigger a rebuild. If the error persists, it likely means better-sqlite3 is not yet compatible with Bun's ABI, and there is currently no official way to use Bun's built-in SQLite driver with Prisma. Keep an eye on updates from both Bun and Prisma for improved compatibility in the future. If you ne ed a working setup today, consider using Node.js until Bun and better-sqlite3 compatibility is confirmed. 🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly. In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.
Could you provide a minimal reproduction for us to investigate?
Thanks for getting back to me. Reproduction repo is here for you: https://github.com/ytsruh/bun-prisma-rustfree-repro
GitHub
GitHub - ytsruh/bun-prisma-rustfree-repro: A reproduction of a Bun/...
A reproduction of a Bun/Prisma Rust free engine error - ytsruh/bun-prisma-rustfree-repro
@Nurul are you able to use this repro?