Is drizzle edge compatible (noobie question)?

Hi, I'm new to drizzle. I tried to set up a drizzle client with turso in cloudflare workers and I get these errors:
[ERROR] Could not resolve "node:buffer"

../../node_modules/@libsql/client/lib-esm/sqlite3.js:2:23:
2 ā”‚ import { Buffer } from "node:buffer";
ā•µ ~~~~~~~~~~~~~

The package "node:buffer" wasn't found on the file system but is built into node. Are you
trying to bundle for node? You can use "platform: 'node'" to do that, which will remove
this error.

āœ˜ [ERROR] Could not resolve "fs"

../../node_modules/better-sqlite3/lib/database.js:2:19:
2 ā”‚ const fs = require('fs');
[ERROR] Could not resolve "node:buffer"

../../node_modules/@libsql/client/lib-esm/sqlite3.js:2:23:
2 ā”‚ import { Buffer } from "node:buffer";
ā•µ ~~~~~~~~~~~~~

The package "node:buffer" wasn't found on the file system but is built into node. Are you
trying to bundle for node? You can use "platform: 'node'" to do that, which will remove
this error.

āœ˜ [ERROR] Could not resolve "fs"

../../node_modules/better-sqlite3/lib/database.js:2:19:
2 ā”‚ const fs = require('fs');
here is my db configuration
import { createClient } from "@libsql/client";
import { drizzle } from "drizzle-orm/libsql";

import { env } from "../env";

const client = createClient({
url: env.DATABASE_URL,
authToken: env.DATABASE_AUTH_TOKEN,
});

export const db = drizzle(client, {
});
import { createClient } from "@libsql/client";
import { drizzle } from "drizzle-orm/libsql";

import { env } from "../env";

const client = createClient({
url: env.DATABASE_URL,
authToken: env.DATABASE_AUTH_TOKEN,
});

export const db = drizzle(client, {
});
šŸ˜“
2 Replies
nickmazuk
nickmazukā€¢16mo ago
According to the @libsql/client docs, use the @libsql/client/http import instead.
import { createClient } from "@libsql/client/http";
import { createClient } from "@libsql/client/http";
Pachimari
PachimariOPā€¢16mo ago
You're a man, a savior. Thanks!
Want results from more Discord servers?
Add your server