Open ImBIOS opened 11 months ago
I ran into this issue and I made https://www.npmjs.com/package/@hebilicious/libsql-client while working on https://github.com/libsql/libsql-client-ts/pull/71
This works with drizzle :
import { drizzle } from "drizzle-orm/libsql"
import { createClient } from "@hebilicious/libsql-client"
const url = process.env.DATABASE_URL ?? "file:drizzle/local.db"
const authToken = process.env.DATABASE_AUTH_TOKEN
console.log(`Connecting to ${url}...`)
export const client = createClient({ url, authToken })
export const db = drizzle(client)
Are you bundling with webpack
? This looks like either a webpack or drizzle issue.
related thread in webpack repo https://github.com/webpack/webpack/issues/12792
To use bun:sqlite with webpack, bun:sqlite needs to be marked as external. Similar to how there is a node externals webpack plugin, there needs to be a bun externals webpack plugin.
To use bun:sqlite with webpack, bun:sqlite needs to be marked as external. Similar to how there is a node externals webpack plugin, there needs to be a bun externals webpack plugin.
I see, got it. Tried to update
// next.config.js
module.exports = {
webpack: (config) => {
config.externals.push('bun:sqlite');
return config;
},
};
It worked in next dev
. But having an issue when I try to build it.
Running bun run build
(seems using nodejs)
will fail
Collecting page data ..Error: Cannot find module 'bun:sqlite'
force running build in bun with bun run --bun build
also failed:
Export encountered errors on following paths:
/_error: /404
...
seems related to this https://github.com/oven-sh/bun/issues/4795 for anyone who try to use Bun + Nextjs + Docker
What version of Bun is running?
0.8.1
What platform is your computer?
Darwin 23.0.0 arm64 arm
What steps can reproduce the bug?
Try
drizzle-orm
withbun:sqlite
exampleReference: https://orm.drizzle.team/docs/installation-and-db-connection/sqlite/bun
What is the expected behavior?
It should run like we run normal sqlite, but blazingly fast 🔥 ⚡
What do you see instead?
Additional information
Environment: