Unable to insert rows when using libsql

hey, i am using libsql on my local environment with drizzle but i am unable to insert anything in the database. the promises seem to be broken. i am on the latest drizzle orm and kit version. here is the code to reproduce:
await db.insert(anyRow).values({
foo: "bar",
});
await db.insert(anyRow).values({
foo: "bar",
});
my drizzle client code looks like this:
import { drizzle } from "drizzle-orm/libsql";
import { migrate } from "drizzle-orm/libsql/migrator";
import { createClient } from "@libsql/client";
import { schema } from "./schema";
import { env } from "~/env";

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

export const db = drizzle(client, { schema });

migrate(db, { migrationsFolder: "./drizzle" })
.then(() => console.log(`✅ [drizzle] database migrated`))
.catch((err) => {
console.log(`❌ [drizzle] error migrating database:`);
console.error(err);
}
);

export type DbClient = typeof db;
import { drizzle } from "drizzle-orm/libsql";
import { migrate } from "drizzle-orm/libsql/migrator";
import { createClient } from "@libsql/client";
import { schema } from "./schema";
import { env } from "~/env";

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

export const db = drizzle(client, { schema });

migrate(db, { migrationsFolder: "./drizzle" })
.then(() => console.log(`✅ [drizzle] database migrated`))
.catch((err) => {
console.log(`❌ [drizzle] error migrating database:`);
console.error(err);
}
);

export type DbClient = typeof db;
and i am basically using websockets with the help of turso for local development. thanks!
1 Reply
Dan
Dan2y ago
Probably already answered, but you're missing .run() at the end of your query
Want results from more Discord servers?
Add your server